Insert Into Array function

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

The Insert Into Array function inserts one or more elements or subarrays into an array.

Usage

Connect an array of any type to the n-dim array input terminal and a new element or subarray to n or n-1 dim array. This will add the new element(s) to the end of the array.

Insert Into Array - Insert At End.png

Specify an index at the index terminal to insert element(s) at any other position in the source array.

Insert Into Array - Insert At Mid.png

Insert multiple elements by dragging the upper or lower side of the node. This will increase the number of element(s) at the second, third, ... position starting at the specified index.

Insert Into Array - Insert Multiple At Mid.png

The input terminal n or n-1 dim array (n or n-1 dimensional array) only accepts elements that have the same number of dimensions as the input array or one dimension less. It is not possible to insert a single element into a 2-dimensional array, because it must be at least one-dimensional. Attempting to do so will result in broken wires.

Insert Into Array - Broken Wires For Incorrect Number Of Dimensions.png

Best practice

  • Do not specify an index to add elements or subarrays to the end of the array.