LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
grubin698

Sort 2D array on Column/Row#

Status: New

I often find myself having to sort the rows of a 2D array based on a one of the columns.  It would be nice to be able to have a native function for that.  Currently I turn each row into a cluster, sort the array of clusters, then convert back to a 2D array -- way too much overhead and wiring time. 

 

Instead, I envision something like Matlab's sortrows or Excel's expand selection.  

Inputs would be a 2D array, a column index, and an ascending/descending selector. Output would be the 2D array with rows reordered such that the specified column is sorted.

3 Comments
tst
Knight of NI Knight of NI
Knight of NI

I agree that this would be nice as a shipping function, but you should note that OpenG already has a VI which does this for most common data types.


___________________
Try to take over the world!
grubin698
Member

Thanks,

I wasn't aware of the OpenG function.

 

PiF
Member
Member

Dear Ni comunity

I'm a bit disapointed by this thread. Having the same question I downloaded the openG array sorter. this Vi  turn each row into a cluster, sort the array of clusters, then convert back to a 2D array.HAving alot of these operation to perform I was hoping for a faster method avoiding the cluster conversion and the twofold array indexing...

any clue?

Best regards