Sorting with IDL... Please give me any suggestions!!! [message #52035] |
Thu, 21 December 2006 05:26 |
kim20026
Messages: 54 Registered: November 2006
|
Member |
|
|
I am trying to learn the sort function in IDL. I would like to sort the
final grades of my students in this semester.
Jung 75
Hyun 98
Ji 95
Young 92
Chun 88
Dong 89
Joo 87
Won 82
Du 86
Jin 84
I saved these data in 'score.txt' file. I checked the sort function in
IDL online help. The explanation was only for 1 dimensional array, but
it was not useful for me. I just made a simple code like this, but it
didn't work properly.
------------------------------------------
pro grade
nm = strarr(10)
sr = fltarr(10)
gr = [nm, sr]
file='score.txt'
openr, lun, file, /get_lun
readf, lun, gr
PRINT, 'Scores in sorted order: ', sr[SORT(sr)]
print, gr, free_lun, lun
end
--------------------------
I got a 'input conversion error' message and a blue arrow at line 8.
Please let me know what to do. Give me any suggestions. Thanks.
|
|
|