Insert Into Array function: Difference between revisions
Add new page (stub) |
Update and clarify contents |
||
Line 1: | Line 1: | ||
[[File:Insert Into Array - Terminals.png|thumb|Insert Into Array function]] | [[File:Insert Into Array - Terminals.png|thumb|Insert Into Array function]] | ||
{{LabVIEW Palette Object Information|palette=Functions Palette/Programming/Array{{!}}Array palette|type=function}} | |||
The '''Insert Into Array''' function inserts one or more elements or subarrays into an array. | |||
== Usage == | == 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. | |||
[[File: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. | |||
[[File: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. | |||
[[File: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. | |||
[[File: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. | |||
[[Category:Array Palette]] | [[Category:Array Palette]] |
Revision as of 16:22, 5 September 2019

Object information | |
---|---|
Owning palette(s) | 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.
Specify an index at the index terminal to insert element(s) at any other position in the source array.
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.
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.
Best practice
- Do not specify an index to add elements or subarrays to the end of the array.