LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re-arrange 1D array?

Solved!
Go to solution

Hello,

 

How can I re arrange the elements of a 1D array? e.g.   A B C D E F G H  --->  A B E F C D G H

 

Thanks!

0 Kudos
Message 1 of 6
(2,708 Views)

You can use the functions Delete from Array and Insert into Array.  You might also be able to use the In Place Element Structure to minimize the memory footprint of the arrays.

Message 2 of 6
(2,701 Views)
Solution
Accepted by topic author PSerial

Simply use the "Delete From Array" and "Insert Into Array" VIs. See attached.

 

Message 3 of 6
(2,694 Views)

Since the size of the array does not change, delete from array and insert into array should probably not be used for performance reason.

 

  • How big are the arrays?
  • What are the inputs to the function?
  • Is it always the same positions or are the locations variable?
  • Do the sections never overlap?
  • Are the two sections always adjacent?
  • It is possible that the sections are partly outside the valid array boundaries?
0 Kudos
Message 4 of 6
(2,692 Views)

Here are two solutions that operate "in-place" with respect to the large array. Pick one (top or bottom).

 

 

Message 5 of 6
(2,685 Views)

Thanks everyone, that solved it. It was a simple 1D array with values listed above @ altenbach, thanks 🙂

0 Kudos
Message 6 of 6
(2,684 Views)