LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sort 2d array by column

I have a file with rows I am trying to sort by date and time. The date and time are in each row of the file, in a particular column. I have found several vi's on the forum for 2D array sorting, but they all stall out after four rows, and I don't know why. One of the rows seems to go out of whack. I am new to LabView and could use some pointers to a very basic introduction to the array functions. I am learning as I go, but for some reason the array functions are tough for me.

The vi's I have tried from the forum are "1505.zip"; "bubblesort2dstringarrayrows.zip"; "sort2d1.zip", and "alpha_sort.llb". I have attached one of the files I would like sorted, if anyone would care to look at it.

Tay
0 Kudos
Message 1 of 4
(15,213 Views)
All you have to do is import the data into LV such that you get an array of clusters. The cluster contains the data from a single row in the spreadsheet. Once you have this data all you have to do is use the 1D sort function. The trick is that the order the data appears in the cluster sets the sort order. For example, if you want to sort by date first and then time, when you are importing the data make the date the first item in the cluster and the time the second item in the cluster - though practically, you would probably want to combine these two values into a single LV timestamp value...

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 4
(15,208 Views)
I wondered if that was possible! I'll start studying along that line.

Tay
0 Kudos
Message 3 of 4
(15,203 Views)

And if you don't want to write your own, the openg array tools already has a subVI for this  🙂

(see http://jkisoft.com/vipm/)

Message 4 of 4
(15,196 Views)