ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

1D Sort with Index array

I am looking for a very quick way to do a 1D Sort of an array and still keep track of the indices. 
 
Anyone have a good algorithm for this?  Similar to the 1D array sort but has in additional array that shows the index of what went where. 
 
 
 
Regards,
 
-SS


Message Edited by ShotSimon on 07-31-2008 03:04 PM


0 Kudos
Message 1 of 8
(9,777 Views)
Autoindex your array into a FOR loop and bundle the element and the loop index into a cluster which is autoindexed on the right border. Sort the cluster.
Message 2 of 8
(9,768 Views)
Wire the array into a loop, bundle the i terminal and the value and wire out. Sort the new array and the i element will give you the index. OpenG has a VI which does this:

___________________
Try to take over the world!
Message 3 of 8
(9,767 Views)
Well, they beat me to it, but I have a nice picture of my solution, so I'll go ahead and post it 🙂


Message Edited by corys on 07-31-2008 03:14 PM
-Cory
Message 4 of 8
(9,764 Views)


corys wrote:
Well, they beat me to it, but I have a nice picture of my solution, so I'll go ahead and post it 🙂

Hey, I made one too! 😄 (Looks pretty similar, except for the transpose at the end.)

 


Message Edited by altenbach on 07-31-2008 01:18 PM
Message 5 of 8
(9,759 Views)
All,
 
Very nice and thank you for the quick reply.  Tst thanks for elaborating on the OpenG I don't know why but I've never used this before.  Altenbach and Corys thanks for the quick diagrams, I saw some post on the forums but didn't fully understand them until now.  -SS


Message Edited by ShotSimon on 07-31-2008 04:21 PM


0 Kudos
Message 6 of 8
(9,730 Views)

Altenbach,

I was surprised to see you like the large icon look?  No problem I just always figured you as a small icon type of guySmiley Very Happy



Message Edited by ShotSimon on 07-31-2008 04:25 PM


0 Kudos
Message 7 of 8
(9,716 Views)

1D sort documentation doesn't do this vi sub justice:)  Thank you for the very fun elegant solution!  -SS



Message Edited by ShotSimon on 07-31-2008 04:36 PM


0 Kudos
Message 8 of 8
(9,709 Views)