Table Of Contents

Index Array (G Dataflow)

Version:
    Last Modified: March 15, 2017

    Returns the value stored in an array at a specified index.

    connector_pane_image
    datatype_icon

    array

    An n-dimensional array of any type.

    If array is an empty array, element returns the default value of the defined data type for the array.

    This input changes to waveform when the data type is a waveform.

    Data Type Changes on FPGA

    When you add this node to a document targeted to an FPGA, this input has a default data type that uses fewer hardware resources at compile time.

    datatype_icon

    index

    A number that refers to a location within the input array.

    This node automatically provides an index input for each dimension of the array.

    Behavior for Out of Range Values

    If index for any dimension is less than zero or greater than the length of array in that dimension, this node returns the default value of the defined data type for the array.

    Relationship between index Inputs and array Dimensions

    For multidimensional arrays, index inputs correspond to row-major order. Thus, the first index corresponds last dimension of the array input, and the last index corresponds to the first dimension of the array input. The following table shows the relationship between four index inputs and the dimensions of a 4D array input.

    index Order Corresponding Dimension in array Input index Name
    1 4th volume index
    2 3rd page index
    3 2nd row index
    4 1st column index

    Unwired Index Inputs

    Unwired index inputs allow you to retrieve a subarray of the array rather than a single element. For example, to retrieve column 1 of a 2D array, specify 1 in the column index and leave the row index unwired.

    When all index inputs are unwired, the retrieved subarray contains one less dimension than array.

    Relationship between index and Multiple element or subarray Outputs

    If you expand the node to show more than one element or subarray output, the node provides a set of index inputs for each output. The values you wire to a set of index inputs determine the value of the corresponding output. However, if you do not wire values to a set of index inputs, the corresponding element or subarray output returns the element or subarray that follows the previous element or subarray output in the original array. Refer to the Examples tab for an illustration of this relationship.

    Default: 0

    datatype_icon

    waveform

    The waveform whose array of y values you want to use in this operation. This input becomes available when you wire a waveform to array.

    datatype_icon

    element

    The scalar element or subarray stored in array at the specified index.

    Data Type Changes on FPGA

    When you add this node to a document targeted to an FPGA, this input has a default data type that uses fewer hardware resources at compile time.

    Resizing Behavior

    When you wire an array to this node, the node resizes automatically to display index inputs for each dimension in the array you wire to array. You also can add additional element or subarray outputs by resizing the node. The node provides index inputs for each output.

    Accessing a Subarray by Disabling Indexing along a Dimension

    You can disable indexing along a dimension by leaving the corresponding index input unwired. By default, the first dimension has indexing enabled, with the others disabled. 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 node to show another set of input terminals. This next set of inputs has its own corresponding element output. By default, if you do not wire any index input terminals, the first element indexes row 0, the second element indexes row 1, and so on.

    The following image illustrates this node's behavior for a variety of inputs:


    Output Panel Indicator Comments
    element, all indexes wired
    subarray, row wired Without a value for the column dimension, Index Array returns the entire row specified by the row input.
    subarray, indexes unwired This output has no values specified for its corresponding row and column inputs. Therefore, the node returns the subarray that immediately follows the previous output.
    subarray, column wired Without a value for the row dimension, Index Array returns the entire column specified by the column input.

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: This product does not support FPGA devices


    Recently Viewed Topics