Use the Array functions located on the
Functions>>All Functions>>Array palette to create
and manipulate arrays. The more commonly used array functions
include the following:
-
Array Size:
Returns the number of elements in each dimension of an
array. If the array is
nn-dimensional, the
size output is an array of
nn elements. For example, the
Array Size function returns a size
of 33 for the following array.
-
Initialize Array:
Creates an nn-dimensional array
in which every element is initialized to the value of
element. Resize the function to increase the
number of dimensions of the output array. For example, the
Initialize Array function returns the following array for an
element of 44, a
dimension size of
33, and one dimension
size terminal.
-
Build Array:
Concatenates multiple arrays or appends elements to an
nn-dimensional array. Resize the
function to increase the number of elements in the output
array. For example, if you concatenate the two previous arrays
, the
Build Array function returns the following array.
To concatenate the inputs into a longer array of the same
dimension as shown in the following
array, right-click the function node and select
Concatenate Inputs from the shortcut menu to
create the following array.
-
Array Subset:
Returns a portion of an array starting at index
and containing length elements. For example, if
you use the previous array as the
input, the Array Subset function returns the
following array for an
index of 22 and a
length of 33.
-
Index Array:
Returns the element or sub-array of
n-dimension array at index. For
example, if you use the previous
array as the input, the Index Array
function returns 22 for an
index of 00.
You also can use the Index Array function to
extract a row or column of a 2D array to create a subarray of
the original. To do so, wire a 2D array to the input of the
function. Two index terminals are available. The
top index terminal indicates the row, and the
second terminal indicates the column. You can wire inputs to
both index terminals to index a single element,
or you can wire only one terminal to extract a row or column
of data. For example, wire the following
array to the input of the function.
The Index Array function returns the following array for an index
(row) of 00:
"A full introductory course on programming with LabVIEW."