[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: intersection of 2 arrays

dmarshall@ivory.trentu.ca writes:
> I never seem to have the problem at the time when it is being discussed 
> here since I remember something about this in the past.
> I have 2 arrays and would like a 3rd that contains the set intersection of 
> the 2. Each element in each is unique. 
> This seems like a basic function but after searching in help, etc. I didn't 
> come up with an elegant solution. Maybe its too basic and I should know it?

There was an extensive discussion here on this newsgroup a week or two
ago that you should be able to find on www.deja.com.  It got pretty
technical if that's what you want.

For integers with small dynamic range, then the SET_OPERATIONS that
David refers to should be fine.  

If you want a canned solution, you might consider using the CMSET_OP
from here:


It handles other data types, including FLOAT and STRING.  It performs
set union, intersect, and exclusive-or, and also negation (e.g. NOT A


Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response