LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

change order of an array with another array

Solved!
Go to solution

I want to change the order of a 1D array based on another 1D array which specifies the order.  For example, I have an array which has the following items:  12, 13, 14, 15, 16.  And I have another 1D array which specifies an order of 3, 4, 0, 1, 2.  I want the resulting array to be 15, 16, 12, 13, 14.  How do I do this?  This should be really easy.  Another example, I'm given an array in the following order 1,2,3,4,5,6,7 and I have a order specifying array containing 0,6,1,5,2,3,4.  Therefore, the resulting array should be 1,7,2,6,3,4,5.  ???

 

  

0 Kudos
Message 1 of 5
(2,826 Views)
Solution
Accepted by topic author ahhah

This is, in fact, pretty easy.  Put an "Index Array" inside a for loop and wire the two arrays into it.  Disabled auto-indexing on the input array.  Wire the array element to the border of the for loop and you'll have the desired array.

Message 2 of 5
(2,824 Views)

Beautiful!  Thanks

0 Kudos
Message 3 of 5
(2,818 Views)

You should mark Nathan's message as the solution to your question to give him credit since he was the one who told you how to do it.  First, you'll need to unmark your thank you post as the solution by going to the options menu to the upper right of your message.

0 Kudos
Message 4 of 5
(2,811 Views)

Okay, Done. Smiley Happy

0 Kudos
Message 5 of 5
(2,786 Views)