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

Home » Public Forums » archive » Re: Select values from one array that match multiple values from an other array
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: Select values from one array that match multiple values from an other array [message #82217 is a reply to message #82216] Fri, 30 November 2012 07:31 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
PMagdon writes:

> I tried to use WHERE for multiple comparisons of two arrays.
>
> Here is a minimal example:
>
> 1.) Two arrays
>
> A=[1,3,2,5,2,6,1,9]
> B=[1,5]
>
> 2.) I need to extract all positions of A where any of the values from B occur in A. So that C should look like this:
>
> C=[0,3,6]
>
> So far I tested
> C=WHERE(A EQ B) but this doesn't work.
>
> Any ideas how to solve that without looping over B?

c = SetIntersection(a, b)

http://www.idlcoyote.com/tips/set_operations.html

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: need help with idl
Next Topic: Bug in STRMID system routine

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

Current Time: Wed Oct 08 22:38:19 PDT 2025

Total time taken to generate the page: 0.72457 seconds