Jump to content

Insert Into Array function: Difference between revisions

From LabVIEW Wiki
Add new page (stub)
 
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{stub}}
[[File:Insert Into Array - Terminals.png|thumb|Insert Into Array function]]
[[File:Insert Into Array - Terminals.png|thumb|Insert Into Array function]]


Inserts an element or subarray into an n-dimensional array at the specified index. Adds to the end of the array if no index is specified.
{{LabVIEW Palette Object Information|palette=Functions Palette/Programming/Array{{!}}Array palette|type=function|icon=Insert Into Array.png}}


{{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 ==


== Best practice ==
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.


== History ==
[[File:Insert Into Array - Broken Wires For Incorrect Number Of Dimensions.png]]


== See also ==
== Best practice ==


== External links ==
* Do not specify an index to add elements or subarrays to the end of the array.


[[Category:Array Palette]]
[[Category:Array Palette]]

Latest revision as of 04:40, 26 June 2020

Insert Into Array function
Object information
Owning palette(s) Array palette
Type Function
Requires Basic Development Environment
Icon

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.