LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sort Second Element in Array of Strict Type Def Clusters

I need to sort the an array of strict type def clusters by the second or third element in the cluster.  In the past I have used 1-D array sort and sorted by the first element of the cluster.  When I need to sort by the second, third, or fourth element of the cluster I just break down the cluster and rebuild it placing the desired sort element in the first position of the new cluster.  This works for simple tasks and clusters, but as the cluster gets more complicated this becomes a pain to do this.  There must be a cleaner way to sort by other elements within the original array of strict type def clusters.  Has anyone succeeded in doing this a different way?
 
 
0 Kudos
Message 1 of 2
(2,554 Views)

Hello,

Here's the way I would do it...just create a new cluster array, where each cluster contains two elements...the unbundled item you want to sort by, and the cluster itself.  Then sort the new cluster array, then unbundle the sorted cluster array to get the original clusters (now sorted).  Here is a screenshot:

There may be a better way, but this is the first thing I thought of.

-D

Message Edited by Darren on 03-16-200610:00 AM

0 Kudos
Message 2 of 2
(2,538 Views)