Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Index Array

LabVIEW 8.2 Help
August 2006

NI Part Number:
371361B-01

»View Product Info

Returns the element or subarray of n-dimension array at index. When you wire an array to this function, the function resizes automatically to display index inputs for each dimension in the array you wire to n-dimension array. You also can add additional element or subarray terminals by resizing the function. The connector pane displays the default data types for this polymorphic function. Details  

n-dimension array can be an n-dimensional array of any type. If n-dimension array is an empty array, element or subarray returns the default value of the defined data type for the array.
index 0..n-1 must be numeric. The number of index inputs matches the number of dimensions in n-dimension array.

If the index is out of range (<0 or N, where N is the size of n-dimension array), element or subarray returns the default value of the defined data type for the array.

element or subarray has the same type as the elements of n-dimension array. Rather than extracting an element of the array, you can extract a subarray of the array by leaving one or more of the index terminals unwired. For example, extract column 1 of a 2D array by specifying 1 in the column index and leaving the row index unwired.

If you index a 1D array and do not wire an input index terminal, this function extracts the first element of the array. If you grow the node and have more than one element or subarray output, this function extracts the first number of elements equal to the number of element or subarray outputs.

Index Array Details

You can disable indexing along a dimension by leaving the corresponding index input unwired, unless you are indexing a 1D array. By default, the first dimension has indexing enabled, with the others disabled. If disabled, the input terminal is an outlined black rectangle. If enabled, it is filled. You can wire a constant or control to the index inputs that you want enabled.

For example, if you want to index a row in a 2D array, the first index input is enabled and the second index input is disabled. If you want to index that same 2D array also by column, you can resize the function to show another set of input terminals. This next set of inputs has its own corresponding subarray output. By default, if you do not wire any index input terminals, the first subarray indexes row 0, the second subarray indexes row 1, and so on.


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit