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

Home » Public Forums » archive » Finding Common Elements in Two 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: Finding Common Elements in Two Arrays [message #2189 is a reply to message #2111] Fri, 03 June 1994 06:10 Go to previous messageGo to previous message
landers is currently offline  landers
Messages: 45
Registered: May 1993
Member
It's me again...

Now I noticed you want the indices rather than the values.... So


In article <1994Jun3.130243.3453@mksol.dseg.ti.com>, landers@tsunami.dseg.ti.com (David Landers) writes:

|>
|> Na = N_ELEMENTS(a)
|> Nb = N_ELEMENTS(b)
|> L = LINDGEN(Na,Nb)
|> AA = A( L MOD Na )
|> BB = B( L / Na )

Then...

I = AA EQ BB
Ia = UNIQUE( I MOD Na )
Ib = UNIQUE( I / Na )

Now Ia has the indices of A that are in B, and Ib has the indices of B that
are in A. Leave off the UNIQUE if you care that an element matches multiple
times.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Finding common elements in two arrays
Next Topic: Please help with buggy widget code

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

Current Time: Fri Oct 10 04:21:12 PDT 2025

Total time taken to generate the page: 1.03932 seconds