LABVIEW – TWO DIMENSIONAL USING LOOPS AND DATA STRUCTURE USING WIRES
TWO-DIMENSIONAL ARRAY USING LOOPS:
A two-dimensional array can be generated easily using two nested For Loops, i.e. by placing one For Loop inside the other as shown in below Figure. In this case the outer loop will correspond to the rows of the array and the inner one to the columns. In the example shown in Figure, the two-dimensional array generated consists of five rows and four columns.
IDENTIFICATION OF DATA STRUCTURE (SCALAR AND ARRAY) USING WIRES:
Scalar values are indicated by thin wire, one-dimensional arrays are indicated by a thick wire and two-dimensional arrays are indicated by two wires with color appropriate to the data type. Arrays of larger dimensions are also indicated by two wires, but with a greater spacing. A three-dimensional (3D) array, a (i, j, k) will have ‘i’ indicating the page, ‘j’ the row and ‘k’ the column. One can consider the array to be like a pack of cards, with the page indicating the card in the deck. All indices start from zero. The below Figure shows the wires corresponding to a scalar as well as one-dimensional, two-dimensional and three-dimensional arrays.
DATA STRUCTURES IN LABVIEW ARE:
String Data Type
A string is a sequence of displayable or non displayable ASCII characters. Strings provide a platform-independent format for information and data. Some of the more common applications of strings include the following:
- Creating simple text messages.
- Controlling the instruments by sending text commands to the instrument and returning data values in the form of either ASCII or binary strings, which you then convert to numeric values.
- Storing numeric data to disk. To store numeric data in an ASCII file, we must first convert numeric data to strings before writing the data to a disk file.
- Instructing or prompting user with dialog boxes.
On the front panel, strings appear as tables, text entry boxes, and labels. LabVIEW includes built-in VIs and functions you can use to manipulate strings, including formatting strings, parsing strings, and other editing. LabVIEW represents string data with the color pink.
Numeric Data Type
LabVIEW represents numeric data as floating-point numbers, the fixed-point numbers, the integers, the unsigned integers, also complex numbers. The Double and Single precision as well as Complex numeric data is represented with the color orange in LabVIEW. The all Integer numeric data is represented with the color blue.
Certain data types also provide extended configuration options. As an example, you can associate physical units of measure with floating-point data, which including complex numbers, you can configure the encoding as well as range for fixed-point data.
Boolean Data Type
LabVIEW stores Boolean data as 8-bit values. The Boolean can be used in LabVIEW to represent a 0 or 1, a TRUE or FALSE. In case if the 8-bit value is zero, then Boolean value is FALSE. Any nonzero value represents TRUE. The Common applications for Boolean data include representing digital data and serving as a front panel control that acts as a switch that has a mechanical action often used to control an execution structure such as a Case structure. A Boolean control is typically used as the conditional statement to exit a While Loop. LabVIEW, color green represents Boolean data.
Dynamic Data Type
Most Express VIs accepts and/or returns the dynamic data type, that appears as a dark blue terminal.
Using the Convert to Dynamic Data and Convert from Dynamic Data VIs, you can convert floating-point numeric or Boolean data of the following data types:
- 1D array of waveforms
- 1D array of scalars
- 1D array of scalars – most recent value
- 1D array of scalars – single channel
- 2D array of scalars – columns are channels
- 2D array of scalars – rows are channels
- Single scalar
- Single waveform
Wire the dynamic data type to an indicator that can best present the data. The indicators include a graph, the chart, or numeric, or Boolean indicator. Because dynamic data undergoes an automatic conversion to match the indicator to which it is wired, the Express VIs can slow down the block diagram execution speed.
The dynamic data type is for use with Express VIs. The most other VIs and functions that are shipped with LabVIEW do not accept this data type. Use a built-in VI or function to analyze or process the data the dynamic data type includes, we must convert the dynamic data type.
Sometimes it is beneficial to group data related to one another. To use arrays and clusters to group related data in LabVIEW. The Arrays combine data of the same data type into one data structure, and clusters combine data of multiple data types into one data structure.
An array consists of elements and dimensions. Elements are the data that make up the array. A dimension is the length, height, depth of an array. The array can have one or more dimensions and as many as (231) – 1 elements per dimension, the memory permitting.
Clusters group data elements of mixed types. Example of a cluster is the LabVIEW error cluster, which combines a Boolean value, numeric value, a string. The cluster is similar to a record or a struct in text-based programming languages.
Bundling several data elements into clusters eliminates wire clutter on the block diagram and reduces the number of connector pane terminals that subVIs need. Connector pane has 28 terminals. In case your front panel contains more than 28 controls and indicators that you want to pass to another VI, then group some of them into a cluster and assign the cluster to a terminal on the connector pane.
An enum (enumerated control, constant or indicator) is a combination of data types. Enum represents a pair of values, string, numeric, enum can be one of a list of values. As example, if you created an enum type called Month, possible value pairs for a Month variable like January-0, February-1, through December-11.