Technical Article

Data Types Used in LabVIEW

September 21, 2021 by Seth Price

LabVIEW uses different data types to store and convey information. Let’s review the most common types and how they are used in the program.

Like all programming languages, NI’s LabVIEW software uses different data types to store and convey information to and from different parts of the program. Data types must remain consistent throughout, though there are ways to convert one data type to another, such as converting a numeric type to a string.

While there are many data types, they can be grouped into: boolean, numeric, string, arrays, clusters, and others.


Boolean Data

Boolean data represents a single bit of information. One bit has a value of either “true” or “false.”  Switches and buttons typically provide a boolean output, as the switch is either in one position or another, and the button is either pressed or unpressed. In LabVIEW, LEDs on the front panel are often the recipients of boolean data, as the light is either on or off.

One useful purpose of boolean data is in digital logic. Boolean inputs can represent an “emergency stop” button’s input, where a “true” signal means the button has been pressed. Data can be processed through digital logic gates, such as AND, OR, and NOT, so multiple digital boolean signals can be combined and form one output control signal.

For example, suppose a piece of industrial equipment has an emergency stop button and a safety interlock to keep people out of moving machinery. If either of these sends a “true” signal, the machine must stop. An OR statement can be placed in the block diagram to combine these signals.


Figure 1. A more complicated emergency stop system.


In figure 1, there are two emergency stop buttons, either of which will stop the machine. There is also an interlock that will stop the machine unless a key is in place.

In LabVIEW, boolean data is represented by the color green. All of the wires going to and coming from boolean objects are green, and the icons are outlined in green on the block diagram.


Numeric Data

There are multiple numeric types of data. First, numeric types are specified by the sub-type, such as signed or unsigned integer, or double-precision floating point, and then specified by the number of bits used to store the data. The more bits available to store data, the larger the number that can be represented. Data-type U32 would be an unsigned integer with 32 bits of storage space.



Integers are a sub-type of numeric data, where only whole numbers can be represented. This means no decimal points are allowed. They are available in several sizes, ranging from 8-32 bits, and are indicated by blue outlines and wires. Integers can either be signed or unsigned, meaning one of the bits indicates whether the number is positive or negative.


Figure 2. A numeric control (32-bit signed integer).


Double-precision Floating Points (Doubles)

Doubles are another sub-type of numeric data. Unlike integers, they can represent a decimal number. A double has 15-digit precision, as some of the memory places the decimal point. Numeric indicators and controls of doubles are outlined in orange.


Figure 3. A numeric control (double).


String Data

String data type stores text data—everything from names, status messages, detailed descriptions, and converted data to be written to files. Strings move along pink wires from icons with a pink outline.


Figure 4. A string control.


One of the most useful purposes of strings is for writing data to file. Numeric data must be converted to a string, but the resulting string can be written easily to file for future analysis and troubleshooting.


Data Arrays

Arrays are a way to group like data types together. They must be specified as a control or an indicator but can hold any other data type. Instead of tracking five different integers, one array of integers could have five elements. Numerous array tools are available in the functions palette that can pull subsets, search, break apart, or combine an array. Furthermore, arrays can be fed into a For Loop, and the For Loop will execute once for each element in the array.

For example, suppose that a system has eight modules, each with its own status light to indicate errors. If an error is detected, a light illuminates on the front panel to represent a problem in the appropriate module. This system could be built using eight individual error-checking routines, one for each module. However, a smarter way to design this would be to arrange this data in an array of booleans. The error checking routine can perform its check and only change the array element corresponding to the module with the error.


Figure 5. An array of LEDs.


If the routine in figure 5 is executed, all the LEDs will be turned off. If this system were to be expanded to include more lights, this piece of code would not change; only the number of status lights on the output would need to be larger. Notice the For Loop has no input to the “N” terminal; the array automatically sets the number of iterations needed.

Arrays can make the system much more robust. Suppose the system above must be expanded from eight modules to 12. Instead of wiring four new pieces of code, the array can be expanded to 12 elements instead of eight.


Data Clusters

While arrays are great for grouping data of like data type, a cluster groups different data types. Suppose a data acquisition system had to read two temperatures (doubles), the status of a cooling fan (boolean), and a status message (string) for each loop iteration. It would be possible to track these data point types individually, with individual wires leading from each, but wouldn’t it be nice to “bundle” some of these together?


Figure 6. The four measurements are “bundled” into a cluster. The cluster is then displayed on a cluster indicator, shown on the front panel.


Clusters drastically reduce the amount of wiring a virtual instrument (VI) requires. Elements in the cluster can be accessed and used individually (bundle by name and unbundle by name in the functions palette).


Others Data Types

LabVIEW also has a few other specialty data types, such as FilePath (turquoise), which specifies the filename and directory structure, timestamp (maroon), which indicates the date and time, and a few others.


Figure 7. Error cluster indicator has a status (boolean), a code (integer), and a source (string).


One of the more useful types is an “error cluster.” An error cluster (“beer” colored wires) passes along any errors that occur at runtime. Rather than crashing the program, an error cluster catalogs the error so that the programmer can determine what actions should be taken.

There are many types of data available in LabVIEW, and with a little practice, the programmer can optimize their use in different situations. Which data type do you use most often?