sorting column arrays [message #49159] |
Fri, 30 June 2006 04:16 |
googlegroups
Messages: 6 Registered: February 2006
|
Junior Member |
|
|
I have a data set which looks something like this:
STD 1 -97 0 808960
STD 2 -97 0 813056
STD 3 -97 0 817152
STD 4 -97 0 821248
STD 5 -97 0 825344
STD 1 -84 1 829440
STD 2 -84 1 833536
STD 3 -84 1 837632
STD 4 -84 1 841728
STD 5 -84 1 845824
STD 1 -71 2 849920
STD 2 -71 2 854016
STD 3 -71 2 858112
STD 4 -71 2 862208
STD 5 -71 2 866304
and so on.
The data is currently stored in a 1 by 3000 string array (I have read
the data in line by line). I am intending to extract the data further
using
FOR i=0,n_elements(array)-1 DO BEGIN
new_array[*,i] = strtrim(strsplit(array[i], /extract),2)
END
I'd like to sort the data by the third column as a first priority, then
using the fourth if data can be sorted further, then the second (you
know, like in Excel and the like).
Could anyone point me in the right direction on this? (Also I'd
appreciate any tips on avoiding that FOR loop.)
Many thanks
Dave Higgins
|
|
|