Insert into Array

Inserts an element or subarray into an array at the index you specify.

1378

Inputs/Outputs

datatype_icon

array

The array in which you want to insert an element, row, column, page, and so on. This input is an n-dimension array of any type.

datatype_icon

index

The location in the array where you want to insert the element, row, column, page, and so on. This node automatically provides an index input for each dimension of the array. You can wire only one index input.

If index is larger than the array size, the node does not insert anything into the input array.

Default value: new element or subarray appends to the end of 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
datatype_icon

new element or subarray

The element or array that inserts into an element, row, column, or page in the array specified in array.

The data type of the new element or subarray must be the same type as the input array.

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

output array

The array with the inserted element(s).

Resizing Behavior Based on an Index Input

This node resizes the array along one dimension. Therefore, you can wire only one index input. The index you wire determines the dimension into which you can insert new element or subarray. For example, to insert rows, wire the row index, or to insert columns, wire the column index.

Requirements for new element or subarray Dimension

new element or subarray array