LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting a 2 dimensional array

Looking for an efficient method of sorting a 2 dimensional array using a numbered
column as the sorting criteria. The array has no fixed number of columns
or rows. Im sure there are many methods. Looking for an efficient and neat
method.
Any help or direction most appreciated
Thanks
Diarm
0 Kudos
Message 1 of 2
(2,424 Views)
Diarmid Milligan wrote:

> Looking for an efficient method of sorting a 2 dimensional array using a numbered
> column as the sorting criteria. The array has no fixed number of columns
> or rows. Im sure there are many methods. Looking for an efficient and neat
> method.
> Any help or direction most appreciated
> Thanks
> Diarm

There is an example at zone.ni.com. Search for 'sort 2D'
It takes the 2D array, uses the index Array function to strip the 2D by column
into 2 - 1D arrays. These are sent to the build cluster and the cluster
(a 1D array of cluster of 2 DBLS) is sent to the Sort 1D array.
This output is sent to a for loop that uses the autoindex. Inside the for
is a Cluster to Array function that creates the output 2D.

Not sure how effiecient this is bu
t probably as good or better than any other method
I can think of.
Kevin Kent
Message 2 of 2
(2,424 Views)