Last change
on this file since 231 was
231,
checked in by pinsard, 17 years ago
|
improvements/corrections of some *.pro headers
|
-
Property svn:keywords set to
Id
|
File size:
972 bytes
|
Rev | Line | |
---|
[142] | 1 | ;+ |
---|
[231] | 2 | ; |
---|
[163] | 3 | ; @file_comments |
---|
[142] | 4 | ; |
---|
[163] | 5 | ; @categories |
---|
| 6 | ; |
---|
| 7 | ; @param DIMS |
---|
| 8 | ; |
---|
| 9 | ; @keyword INVERSE |
---|
| 10 | ; |
---|
| 11 | ; @returns |
---|
| 12 | ; |
---|
| 13 | ; @uses |
---|
| 14 | ; |
---|
| 15 | ; @restrictions |
---|
| 16 | ; |
---|
| 17 | ; @examples |
---|
| 18 | ; |
---|
| 19 | ; @history |
---|
| 20 | ; |
---|
| 21 | ; @version |
---|
| 22 | ; $Id$ |
---|
| 23 | ; |
---|
[142] | 24 | ; @todo seb |
---|
| 25 | ; |
---|
| 26 | ;- |
---|
[231] | 27 | ; |
---|
[53] | 28 | function sortdim, dims, inverse=inverse |
---|
| 29 | ; |
---|
[231] | 30 | ; IDL> a=['x','y','t','z'] |
---|
| 31 | ; IDL> b=a[sortdim(a)] |
---|
| 32 | ; IDL> print, a |
---|
[53] | 33 | ; x y t z |
---|
[231] | 34 | ; IDL> print, b |
---|
[53] | 35 | ; x y z t |
---|
[231] | 36 | ; IDL> print, b[sortdim(a,/inv)] |
---|
[53] | 37 | ; x y t z |
---|
| 38 | ; IDL> a='xytz' |
---|
| 39 | ; IDL> print, sortdim(a) |
---|
| 40 | ; 0 1 3 2 |
---|
| 41 | ; |
---|
| 42 | ; |
---|
| 43 | ; |
---|
[114] | 44 | ; |
---|
| 45 | compile_opt idl2, strictarrsubs |
---|
| 46 | ; |
---|
[53] | 47 | tosort = dims |
---|
| 48 | if n_elements(tosort) eq 1 then $ |
---|
| 49 | tosort = string(reform(byte(tosort),1,(strlen(tosort))[0])) |
---|
| 50 | tosort = strrepl(tosort,strwhere(tosort,'x'),'a') |
---|
| 51 | tosort = strrepl(tosort,strwhere(tosort,'y'),'b') |
---|
| 52 | tosort = strrepl(tosort,strwhere(tosort,'z'),'c') |
---|
| 53 | tosort = strrepl(tosort,strwhere(tosort,'t'),'d') |
---|
| 54 | tosort = uniq(tosort,sort(tosort)) |
---|
| 55 | if keyword_set(inverse) then tosort=sort(tosort) |
---|
| 56 | return, tosort |
---|
| 57 | |
---|
| 58 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.