Index Array function

From LabVIEW Wiki
Jump to: navigation, search
Index Array function
Object information
Owning palette Array palette
Type Function
Requires Basic Development Environment

The Index Array function returns a single element or subarray at a specific index from an array of any type.

Usage

Connect an array to the input terminal n-dimension array to get the first element or subarray (index 0).

Index Array - Get First Element.png

Change the number of indices at the node by dragging the upper or lower side. This will cause the node to return the second, third, ... element or subarray (index 1, 2, ...).

Index Array - Get First Few Elements.png

Specify an index at the index input terminal to start at a specific element from the array. The input terminals following after that are automatically incremented.

Index Array - Get Specific Elements.png

For multidimensional arrays, the number of terminals for each element or subarray matches the number of dimensions of the source array.

Index Array - Get First Subarray.png

The index terminals for multidimensional arrays are sorted in descending order, with the top terminal for the highest dimension. The first four dimensions are given names. From the fifth dimension onward, terminal names increment with the pattern "dim<n>", where "<n>" is the dimension number.

Dimensions Index terminals
1 index
2 row, col
3 page, row, col
4 vol, page, row, col
5 dim5, vol, page, row, col

Best practice

  • Do not specify an index for the first element or subarray (index 0).
  • Use a single Index Array node to get multiple elements or subarrays from the same array in one VI.