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

Home » Public Forums » archive » sorting string arrays - non alphabetic and user defined order
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
sorting string arrays - non alphabetic and user defined order [message #50654] Mon, 16 October 2006 03:34 Go to previous message
rkombiyil is currently offline  rkombiyil
Messages: 59
Registered: March 2006
Member
Fellow Uber-idlers,

I am terrified/mortified/petrified and stupified by this problem.. I am
too lazy and try to do as much text processing and unixing from within
IDL .. with as little user intervention as possible :-)
Maybe this is too obvious for you ubergeeks, I guess my greycells don't
have many pathways...

--
Say, I have a list of names stored in this way:

namelist=['Daddy','Groggy','Ally','Curry','Emmy','Bully','Jo ckey','Hippy','Itchy','Fluffy']

I have another list of names, which

1. may/may not contain all the names in the above list.

2. and this list is ouput (and alphabetically sorted by default) from
IDL. But I want to sort this array the way I want, for example,
comparing to 'namelist'.

For example: IDL sorted list is:

mylist=['Emmy','Fluffy','Itchy',Jockey']

I want to reorder 'mylist' comparing to 'namelist' to
['Emmy','Jockey','Itchy','Fluffy'] and also reset the indices to
[0,1,2,3] instead of [4,9,8,6]

I hope I made sense.. That is

* take 'mylist'
** compare with 'namelist'
*** order names in 'mylist' in the same way as in 'namelist' accounting
for missing names
**** reset indices starting from 0 in the reordered list
--
I tried couple of different permutations and combinations using stregex
and such, but I screw up when it comes to resetting indices in the
reordered list :( I think pointers is the way to go, but I haven't
learned pointers in IDL.

Any suggestions or advice appreciated!
Thanks in advance,
~rk
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: path to .sav file
Next Topic: Re: Retrieving the title of a widget_base after the fact.

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

Current Time: Wed Oct 08 19:37:46 PDT 2025

Total time taken to generate the page: 0.00360 seconds