[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

error with sort



Hi,

SORT() is not platform independent!!!!!


Try this: 


** Structure !VERSION, 5 tags, length=40:
   ARCH            STRING    'x86'
   OS              STRING    'Win32'
   OS_FAMILY       STRING    'Windows'
   RELEASE         STRING    '5.2'
   BUILD_DATE      STRING    'Oct 30 1998'

OR

* Structure !VERSION, 5 tags, length=40:
   ARCH            STRING    'x86'
   OS              STRING    'Win32'
   OS_FAMILY       STRING    'Windows'
   RELEASE         STRING    '5.3'
   BUILD_DATE      STRING    'Nov 11 1999'


a=[1,1,1,1,1]
idx=sort(a)
PRINT,idx

1           2           3           4           0


b=['A','B','C','D','E']
PRINT,b[idx]

B C D E A


** Structure !VERSION, 5 tags, length=40:
   ARCH            STRING    'ibmr2'
   OS              STRING    'AIX'
   OS_FAMILY       STRING    'unix'
   RELEASE         STRING    '5.2.1'
   BUILD_DATE      STRING    'Jun  4 1999'


a=[1,1,1,1,1]
idx=sort(a)
PRINT,idx

 1           0           2           4           3


b=['A','B','C','D','E']
PRINT,b[idx]

B A C E D



================================================


R.Bauer
begin:vcard 
n:Bauer;Reimar 
x-mozilla-html:TRUE
org:Forschungszentrum Jülich
adr:;;;;;;
version:2.1
email;internet:r.bauer@fz-juelich.de
x-mozilla-cpt:;-1
fn:R. Bauer
end:vcard