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

Home » Public Forums » archive » Re: Select Equal elements from 2 arrays
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 Equal elements from 2 arrays [message #60961 is a reply to message #60960] Mon, 23 June 2008 08:17 Go to previous message
humanumbrella is currently offline  humanumbrella
Messages: 52
Registered: June 2008
Member
On Jun 23, 11:11 am, maffie <matthias.demuz...@geo.kuleuven.be> wrote:
> Dear all,
>
> I have 2 arrays, of unequal length, who hold a number of indices that
> are referring to a location of another array.
> Now, I would like to choose these elements which appear in both arrays
> A and B.
>
> For example:
>
> A = [0,8,16,36,49]
> B =[1,8,33,36,49]
>
> result = [8,49]
>
> Isn't there a simple function to do that? I can't find anything
> although I have tried with SORT, UNIQ and WHERE??
>
> Thank you!
> Matthias

A = [0,8,16,36,49]
B =[1,8,33,36,49]

print, a[where(a eq b)]

gives me: 8 36 49

Good luck (:
--Justin
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Select Equal elements from 2 arrays
Next Topic: IDL_IDLbridge, status

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

Current Time: Fri Oct 10 00:36:01 PDT 2025

Total time taken to generate the page: 3.12072 seconds