LabVIEW Data types
Last updated on Dec Fri, 2022 4690
Introduction to LabVIEW:
LabVIEW is one of the software development system first introduced by National Instruments Inc. This software development system is used in many applications such as industrial applications, experiment applications, educational measurement applications, and automation applications. LabVIEW tool is available in the form of graphical programming type, which supports many textual programming languages like C, MATLAB programming, and Math Script. LabVIEW system contains a large number of functional features that perform operations like Visualization, designing, and numerical analysis applications. The important applications used are mathematical concepts, controlling, signal processing system, system and data identifications, and simulation applications. The LabVIEW also supports third-party communications with hardware systems like OPC, GPIB, and Modbus, etc.
LabVIEW data types:
There are seven types of Data structure available to perform many operations in loops, and conditions. I would like to mention the data types;
- String data types
- Numeric data types
- Boolean data types
- Dynamic data types
Let’s discuss them one by one,
String data type:
A string is nothing but a set or sequence of ASCII characters, which can be differentiated into Displayable and non-displayable. String data types in LabVIEW offers platform-independent data and information formats. Some of the very important applications included are,
- Creation of simple information in the form of messages.
- String data can control the instruments by transferring the text commands and it returns the data or information in the form of ASCII characters or binary operations. Users can also convert these ASCII or Binary operators into numeric values.
- The string type also stores the numeric data to Disk. To perform this task, users need to convert the numeric data types into strings before storing the data into the Disk file.
- Instruct or promote the user data with string dialog boxes.
On the front panel of the LabVIEW controllers, string data type appears as tables, labels, texts, and entry boxes. LabVIEW software tool includes many built-in information and functions, this enables the user to manipulate the string characters, formatting of string, parsing string characters, and editing the string value. The pink color dialog box in LabVIEW represents the string.
Numeric Data type:
In LabVIEW, the numeric data types can be represented as floating-point numbers, fixed-point numbers, integer values, singed or unsigned integers, and complex numbers. Double and single floating precision numbers as well as Complex numeric data types are represented with the orange color.
The main difference between the Numeric data types and string data type is that the storage of value.
Few data types in LabVIEW offers extended configuration options. For example, users can measure the physical unit of floating data types, complex numbers, encoding, and range of fixed-point data.
Boolean data types:
LabVIEW system tool stores the Boolean data types as 8-bit values. Boolean type stores the data in the form 0 or 1, or a TRUE or FALSE. While working with conditions, if the data stores the 8-bit as a Zero, then also it represents FALSE. Non-Zero value can be represented as TRUE. Common applications of Boolean data types included are a representation of digital data values and servers as a front panel. The front panel acts as a switch to perform mechanical actions used to control the execution structure mainly case structures. Boolean control in LabVIEW used as conditional statements to exit the while loop statements. The boolean data type can be represented in green color.
Dynamic data types:
Dynamic data type in LabVIEW returns the and/or. The dynamic data type appears as a dark blue terminal on the controllers.
Using the conversion of data types to dynamic data and Vice versa. Users can also convert the Floating-point numeric value or also Boolean data types into the following data types:
- The 1D array of scalars
- The 1D array of Scalars as a most recent value
- The 1D array of scalars as a single channel
- The 2D array of scalars -> uses the columns as channels
- 2D arrays of scalars -> use the rows as channels
- Single scalar methods
- Single waveform
First users need to wire the dynamic data types into an indicator that represents the data. Indicators can be included as a graph, numeric, chart, numeric, or Boolean indicators. More importantly, the dynamic data automatically converted to match the indictor value to be wired, or Express Vis, which will slow down the LabVIEW block diagram execution speed.
The main purpose of using Dynamic data type is to convert any value with Express Vis and functions but sometimes because of its issue with execution LabVIEW will not accept the data type. To make use of built-in VI or any functions to analyze the data or process than data users always chose to go with dynamic data types.
Sometimes there will be beneficial to group related data. In LabVIEW clusters and arrays are used to group the data. The array combines the same data types of the same data point into one data structure, and the cluster combines the multiple data types into one data structure.
An Array can be distinguished into elements and dimensions. Elements are nothing but data points in the array. A dimension can be the length, height, or depth of an array. An array can consist of one 0r more dimensions or many (2 to the power of 31) where 1 element is per dimension and memory permitting.
As we can create an array of numeric values, Boolean values, string data, paths, waveform, and any cluster data types. Users always prefer to work on arrays when there is the same collection of data set and needs computations. One important thing is that you can store the data in the form of waveforms or loops. Each iteration produces the one element of the loop.
Features of Array:
- The array index in LabVIEW is always zero-based.
- The first index of the array, with no dimension, is considered as zero.
- Elements of the array are ordered. An array that uses the index is zero-based, which can range from 0 to n-1.
The following figure represents the array index and its elements.
v Creation of array controls and indicators:
Users can create the array control or indicator on the block diagram front panel just by inserting an array shell as shown in the below figure. In this, you just need to drag the data objects or elements, and then you convert them in the form of numeric or string control.
Suppose if you try to drag any invalid control or indicator values into the array shall on the block diagram, then the array shell becomes invalid and not able to drag.
v Two-Dimensional Arrays:
The previous example shows the 1D array. We can store the elements in a 2-Dimensional array as a grid. This grid comprised of both a column index and a row index to store an array element. The important thing we should know is that all the elements should be non-zero biased and holds 64 elements.
To add any multi-dimensional array to the block diagram front panel, need to right-click the index display -> add the dimension -> from the shortcut menu.
v Initializing Array:
Users can initialize an array element or you can uninitialized it.
Steps involved are:
While initializing the Array -> first you should know the number of elements in dimension and the contents. To do initialization -> fix the number of dimensions -> but no need to insert any array elements.
v Creation of array constants:
To create an array instant on the LabVIEW block diagram -> choose the array instant (icon available on the functions palette),-> now place the array shell on the diagram -> now you can place any form of data values such as string constant, Boolean constant, numeric constant, or any cluster constant.
Users can also use the array constant to store either constant data types or as basic data types.
v Auto-indexing of array inputs:
To auto index any array input, the following steps are included,
If you wire an array element -> to or form any for loop or while loop -> now link each iteration to an element just by enabling the auto-index button. Then immediately the tunnel image will change form Solid Square to the normal auto image which indicates the auto-indexing of an array input. You can disable the auto-index of an array element just by right-clicking the tunnel.
The following image indicates the auto-indexing of array elements.
v Array input:
Once you enable the array auto-index for any for loop-> the input terminal will activate automatically. LabVIEW block diagram has an option to sets the count terminal which enables you to add an appropriate array size, so no need to wire the count terminal. For loops can access the array element one at a time.
The above diagram shows that for loop condition executes the array element like a number of times = number of elements.
v Array outputs:
To perform this task, you should auto-index the array output tunnel, so the output array receives the new elements from every loop iteration. The output tunnel wire to the array indicator becomes thicker; you can identify it by changing an array at the loop border, and an output tunnel square bracket represents an array.
Clusters are a group of data elements of different types. The best example for the cluster is a LabVIEW error cluster, which contains multiple data elements such as, a Boolean value, a numeric value, and a string value. A cluster is nothing but a record that can also be created using a text-based programming language.
Assembling different data elements into the clusters deactivates the wire clutter on the LabVIEW block diagram and also reduces the number of connector terminals. This connector consists of 28 terminals. Suppose if your front panel of connector contains more than 28 controls and indicators, then you should pass them to another Vis. Most of the clusters on the LabVIEW block diagram have pink wire patterns and data terminals. Error cluster can have a dark yellow wire pattern and data terminal. Numeric values in Cluster have brown wire data patterns and terminals. A brown numeric value can be wired to numeric cluster functions like Add or Square root value to perform many operations.
Order of Cluster elements:
We know that both the cluster and array elements are both ordered, you should unbundle the cluster elements using the unbundle functions. You can also unbundle the name function using cluster name elements. Unbundle cluster name function must have a name label. You can differentiate clusters and arrays on the base of their fixed size. The cluster can be either a control or an indicator. One more important thing is that cluster never contains a mixture of controls and indicators.
v Creation of Cluster controls and indicators:
Steps: you can create a cluster control or indicator on the LabVIEW front panel-> by adding cluster shell to the panel as shown in the figure;
v Creation of cluster constants:
Steps involved to create cluster constants: select the cluster constants available on the block diagram functions palette -> place the cluster shell on the front panel block diagram -> add any type of data values ( string, numeric, Boolean, or cluster)-> here select cluster constant to store the constant data values.
v Cluster function usage:
- Helps you to extract the data elements
- Adding individual data elements to the cluster
- Break down of cluster data value into data elements.
Helps users to assemble the cluster data values as shown in the diagram:
To do this task, you need to wire the cluster input -> wire only the data elements you want to change them;
The above is the original diagram without any modification.
v Disassembling the clusters:
There are three ways you can disassemble the cluster,
- Using the unbundle function to split the cluster value into the individual data elements.
- Using of unbundling function names to return the cluster elements. Here the numbers of output cluster terminals are not equal to the number of data elements in the input cluster.
- Using the operating tool to click and unbundle the data elements as shown in the figure;
An enum (enumerated controls, indicators, or constant values) is nothing but a collection of data types. An Enum can represent the pair of data value, a string value, or any numeric value, where enum can be any list of values. For example:
In the below figure, enum type is the month, the possible data value pairs for a month can be January- 0, February-1, and so on till December-11.
Enums are very useful because it’s very easy to manipulate the numbers on the LabVIEW block diagram.
The following diagram describes how to differentiate month values into front panel controllers, selection of an item, and block diagram terminals.
- The probe can be used to check the intermediate values as VI runs.
- Probe makes it easier when you are working with a complicated block diagram by performing a series of operations, like modification, correcting the incorrect data value.
- Probes automatically update and display the data in the Watch window during the time of execution.
In this blog, I have tried to explain the data structure types of LabVIEW. LabVIEW data types are useful to store different data values like numeric, Boolean, string, arrays, clusters, and enum. We can use these types while working with conditions or loop. I hope this blog may help a few of you who are having a dream to pursue the LabVIEW system tool and also for many LabVIEW social forums.
As a content writer at HKR trainings, I deliver content on various technologies. I hold my graduation degree in Information technology. I am passionate about helping people understand technology-related content through my easily digestible content. My writings include Data Science, Machine Learning, Artificial Intelligence, Python, Salesforce, Servicenow and etc.
Upcoming Labview Training Online classes
|Batch starts on 6th Oct 2023||
|Batch starts on 10th Oct 2023||
|Batch starts on 14th Oct 2023||