Summary: In this section, you will learn about arrays.
Note: Your browser may not currently support MathML. See our browser support page for additional details. You can always view the correct math in the PDF version.
Arrays group data elements of the same type. An
array consists of elements and dimensions. Elements are the data
that make up the array. A dimension is the length, height, or
depth of an array. An array can have one or more dimensions and
as many as
You can build arrays of numeric, Boolean, path, string, waveform, and cluster data types. Consider using arrays when you work with a collection of similar data and when you perform repetitive computations. Arrays are ideal for storing data you collect from waveforms or data generated in loops, where each iteration of a loop produces one element of the array.
You cannot create an array of arrays. However, you can create an array of clusters, where each cluster contains one or more arrays. Refer to Clusters for more information about clusters.
Array elements are ordered. An array uses an index so you can
readily access any particular element. The index is zero-based,
which means it is in the range
To create an array control or indicator as shown
in Figure 1, select an array on the
Controls>>All Controls>>Array & Cluster
palette, place it on the front panel, and drag a control or
indicator into the array shell. If you attempt to
drag an invalid control or indicator such as an XY graph into
the array shell, you are unable to drop the control or
indicator in the array shell.
![]() |
You must insert an object in the array shell
before you use the array on the block
diagram. Otherwise, the array terminal appears
black with an empty bracket.
A 2D array stores elements in a grid. It requires a column
index and a row index, both of which are zero-based, to
locate an element. Figure 2 shows a
![]() |
To add dimensions to an array one at a time, right-click the
index display and select Add Dimension from the
shortcut menu. You also can use the Positioning
tool to resize the index display until you have as many
dimensions as you want. Figure 3 is an example of
an uninitialized 2D array control.
![]() |
You can create an array constant on the block
diagram by selecting an array constant from the
Functions>>All Functions>>Array palette, placing
it on the block diagram, and dragging a constant into the
array shell. Array constants are useful for
passing data into a subVI.
"A full introductory course on programming with LabVIEW."