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 #82216 is a reply to message #82215] Fri, 30 November 2012 07:36 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

>
> 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

Whoops! You wanted positions. Nevermind. :-)

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: Sat Oct 11 01:43:38 PDT 2025

Total time taken to generate the page: 1.68188 seconds