Re: 2d where [message #39024] |
Tue, 13 April 2004 15:16 |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Reimar Bauer <R.Bauer@fz-juelich.de> writes:
...
>> IDL> foo = ["a", "b", "c", "d", "e", "f"]
>> IDL> bar = ["b", "e"]
>> IDL> print, where(foo eq bar)
>> -1
>> PERFECTDL> print, where(foo eq bar)
>> 1 4
...
>
> I believe this is duplicated to a thread on the archive
> http://groups.google.de/groups?hl=de&lr=&ie=ISO-8859 -1&q=Vector+comparison+group%3Acomp.lang.idl-pvwave& btnG=Suche&meta=group%3Dcomp.lang.idl-pvwave
... [ corrected link ] ...
Hey, you got German in my Google :-)
Seriously, Reimar is right this comes up often, and I claim you almost
always want CMSET_OP(FOO, 'AND', BAR, /INDICES). This routine works
transparently on both strings and numbers, and scales to large array
sizes without hogging too much memory. All other so-called solutions
are cursed! :-)
The only time you don't want this routine is if you want to preserve
duplicate matches, in which case, good luck!
Craig
P.S. http://cow.physics.wisc.edu/~craigm/idl/idl.html
The only time you don't want that is when
>
> There were 22 entries about this question.
>
>
> Cheers
>
> Reimar
>
> --
> Forschungszentrum Juelich
> email: R.Bauer@fz-juelich.de
> http://www.fz-juelich.de/icg/icg-i/
> ============================================================ ======
> a IDL library at ForschungsZentrum Juelich
> http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
>
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: 2d where [message #39030 is a reply to message #39024] |
Tue, 13 April 2004 10:50  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Graham wrote:
> I have read through the IDL documentation and while it does explain
> why the following doesn't work, it doesn't offer any alternatives :(
>
> I am trying to find the indexes where the elements of 'bar' are equal
> to 'foo'.
>
> IDL> foo = ["a", "b", "c", "d", "e", "f"]
> IDL> bar = ["b", "e"]
> IDL> print, where(foo eq bar)
> -1
> PERFECTDL> print, where(foo eq bar)
> 1 4
>
> Any ideas?
>
> Graham
Dear Graham
I believe this is duplicated to a thread on the archive
http://groups.google.de/groups?hl=de&lr=&ie=ISO-8859 -1&q=Vector+compariso
+group%3Acomp.lang.idl-pvwave&btnG=Suche&meta=group% 3Dcomp.lang.idl-pvwave
There were 22 entries about this question.
Cheers
Reimar
--
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
|
|
|