LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with "insert into array"

Solved!
Go to solution

At first, sorry for my english.

I have a problem with this function, I want insert an element into array of size 16 in function to index, but when I insert an element in the position 4 (for example) and then, I insert other element in the position 2, the element who was in the position 4 is moved to the position 5 and I don't understan why

Can you help me? thank you

0 Kudos
Message 1 of 4
(3,881 Views)
Solution
Accepted by topic author cllorab

Insert into array will increase the size of the array and therefore anything that comes after your insert index will have it's index increased by the number of elements you are inserting.

 

If you want to replace an element in an array - use 'replace array subset'.

 

Here's an example:

ReplaceSubset.png

 

Output:

2016-03-07_10-29-30.png


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 2 of 4
(3,866 Views)

Hi cllorab

 

If you use a "Insert into Array" function, then it Inserts an element into n-dim array at the point you specify in index, thereby moving down the other elements.

If you use " Replace Array Subset" Function, then Replaces an element or subarray in an array at the point you specify in index.

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
Message 3 of 4
(3,863 Views)
Oh, thank you so much!
0 Kudos
Message 4 of 4
(3,850 Views)