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

Home » Public Forums » archive » Re: Efficient comparison of array location in two lists
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: Efficient comparison of array location in two lists [message #75211] Tue, 22 February 2011 02:18 Go to previous message
Heinz Stege is currently offline  Heinz Stege
Messages: 189
Registered: January 2003
Senior Member
The code above contains errors. Wayne Landsman shows an example in
another thread. Here is a copy from my correction:

Good morning!

I should not answer to postings in the middle of the night. I copied
the commands from an existing program in my library and made mistakes
addopting them to the OPs question. Thank you Wayne, for bringing it
out.

And here is the correction:

indx1=sort(foo1)
if n_elements(foo1) ge 2 then $
indx1=indx1[value_locate(foo1[indx1],foo2)] $
else $
indx1=0
indx2=where(foo1[indx1] eq foo2,count)
if count le 0 then message,'No matching labels found.'
indx1=indx1[indx2]

Note, that you have to make changes, if you set the strictarrsubs or
idl2 compiler option. For this case:

indx1=sort(foo1)
if n_elements(foo1) ge 2 then $
indx1=indx1[value_locate(foo1[indx1],foo2)>0] $
else $
indx1=lonarr(n_elements(foo2))
indx2=where(foo1[indx1] eq foo2,count)
if count le 0 then message,'No matching labels found.'
indx1=indx1[indx2]

I hope, that it is working now. Sorry to everybody.

Heinz
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: intersection of two tracks(lat,lon)
Next Topic: RK4 and IDL's array truncation

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

Current Time: Wed Oct 08 17:35:39 PDT 2025

Total time taken to generate the page: 0.00449 seconds