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

Home » Public Forums » archive » Efficient comparison of array location in two lists
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Efficient comparison of array location in two lists [message #75219] Mon, 21 February 2011 15:59
Matt Francis is currently offline  Matt Francis
Messages: 94
Registered: May 2010
Member
I have two sets of data, both comprised of a STRARR labelling the data
and a FLTARR of the data itself.

I want to compare the data in the two sets, but the order and number
of labels are different, so I'd first need to to find which array
elements in each FLTARR correspond to the same label.

It's trivial to see how this can be accomplished by simply looping
over either data set and using WHERE(STRCMP()), but is there a way to
do this without the loop?

To make it clear, say I had:

foo1 = ['a','b','c']
foo2 = ['a','c','b']

I want a single line that produces:

IDL_MAGIC(foo1,foo2,indx1,indx2)
print,indx1,indx2
-> [0,1,2] [0,2,1]

So that could compare

foo1_data[indx1] and foo2_data[indx2] in whatever way I wanted.

Any thoughts?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: BUG: How to crash IDL using !null
Next Topic: intersection of two tracks(lat,lon)

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

Current Time: Wed Oct 08 17:10:00 PDT 2025

Total time taken to generate the page: 0.00484 seconds