LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

return indices of sorted array

I'd like to sort an array and be able to use the sorted indices to sort another array (easy in Matlab).

I see there's an OpenG vi, but I was wondering if it can be done in standard LabVIEW.

Thanks!

0 Kudos
Message 1 of 4
(2,627 Views)

Never mind ... I ended out writing my own vi to sort returning index and then sort using index (attached).

Download All
0 Kudos
Message 2 of 4
(2,621 Views)

I know this topic is pretty old, but I stumbled here searching for a way to do the same thing as you. After trying out your VI, I just had an idea for a much simpler solution:

Bundle the indices with the values and sort an array of clusters. The sort function will sort according to the first item of the cluster, and your indices will stay associated with each value.

0 Kudos
Message 3 of 4
(2,550 Views)

Sorting the array of clusters is what's done in the OpenG VI mentioned in the original post. I'm not sure why the posted didn't just use that VI as it's freely available and its source code is open.


___________________
Try to take over the world!
0 Kudos
Message 4 of 4
(2,527 Views)