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

Home » Public Forums » archive » Re: Efficient comparison of 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: Efficient comparison of arrays [message #9700 is a reply to message #9699] Sun, 10 August 1997 00:00 Go to previous message
David R. Klassen is currently offline  David R. Klassen
Messages: 14
Registered: December 1996
Junior Member
Andy Loughe wrote:
> Given vectors of the type...
>
> a = [1,2,3,4,5]
> b = [3,4,5,6,7]
>
> What is the most efficient way to determine which values that occur in
> a also occur in b (i.e., the values [3,4,5] occur in both a and b).
How about:
x=where(a eq b)
This will give you the index numbers in a of those values that are also in b.
So, to vector of the actual values would be a(x).

--
David R. Klassen
Department of Astronomy
Center for Radiophysics and Space Research
304 Space Sciences Building
Cornell University
Ithaca NY 14853
phone: 607-255-6910
http://faraday.uwyo.edu/grads/dklassen/
drk14@cornell.edu
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Array statistics
Next Topic: Problems with draw widget scrolling in IDL 5.0

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

Current Time: Fri Oct 10 05:49:50 PDT 2025

Total time taken to generate the page: 0.71959 seconds