comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: error with sort
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: error with sort [message #18451 is a reply to message #18447] Mon, 10 January 2000 00:00 Go to previous messageGo to previous message
landsman is currently offline  landsman
Messages: 93
Registered: August 1991
Member
If you are worried about what SORT does to equal values, you might
instead want to use the program bsort.pro, available at

ftp://idlastro.gsfc.nasa.gov/pub/pro/misc/bsort.pro

This procedure ensures that equal values are always maintained in the
initial order, i.e.

IDL> print,bsort([1,1,1,1,1])
0 1 2 3 4

One place where this procedure is useful is when you are sorting on more
than one parameter. For example, suppose you have a set of
temperature and pressure measurements (T, P), and want the primary sort
to be by temperature -- but whenever temperatures are equal, you want
the values sorted by pressure. One can do this as follows:

i1 = sort(P) ;Secondary sort on pressure
i2 = bsort(T[i1]) ;primary sort on temperature

and i2 will give the desired indexing.
Of course, BSORT will be slower than the intrinsic SORT function.

Wayne Landsman landsman@mpb.gsfc.nasa.gov


Sent via Deja.com http://www.deja.com/
Before you buy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: help - sticks plots of u,v/speed direction??
Next Topic: Make TV a function of X?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 12:11:49 PDT 2025

Total time taken to generate the page: 0.24027 seconds