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
Re: sorting string arrays - non alphabetic and user defined order [message #50824 is a reply to message #50654] Tue, 17 October 2006 00:56 Go to previous messageGo to previous message
rkombiyil is currently offline  rkombiyil
Messages: 59
Registered: March 2006
Member
Yes, I agree dwarves are more fun :-)

NamelistA is definitely "superfluous" to the problem. That was just for
clarification's sake.. but I think I didn't do a good job.. Let me try
one last time.
--

I don't know 'mylist' beforehand.

To start with, I have a bunch of random names and I read them into an
array(say, 'givenlist').
Then I compare 'givenlist' with 'namelist' using "strmatch" and obtain
another 'array' (say, 'mylist') ordered in the same way as given in
'namelist'. Since I don't know the dimensions of 'mylist', ( it varies
based on number of elements that are common but it can contain all the
names in 'namelist') I declared the dimension of 'mylist' to be that of
'namelist'.

Tho I can get correct match sorted in the way I want, if some names are
missing from 'namelist',
say,
namelist=
['Daddy','Groggy','Ally','Curry','Emmy','Bully','Jockey','Hi ppy','Itchy','Fluffy']
mylist= ['Groggy', 'Emmy', 'Jockey', 'Itchy', 'Fluffy']
then the dimensions of 'mylist' are still n_elements(namelist) and
strlen(mylist[0]) = 0 ,strlen(mylist[3])=0 etc.

Hence, I was thinking the best way to tackle such a situation would be
to dynamically allocate the size of 'mylist' depending on how many
matches are found between 'namelist' and 'givenlist' .. I am sorry if I
am still not clear and messed up in explaining what I was trying to do.
Maybe it needn't be complicated like this. But I guess I would have to
learn from experiance.

Thanks for taking time off to reply,
~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: Fri Oct 10 14:14:43 PDT 2025

Total time taken to generate the page: 0.96138 seconds