intersect.pro


Name:
intersect
Type:
Function
Arguments:
void[] array1  :  input array 1, type and number of dimensions
void[] array2  : of the arrays maybe anything
nodata   = int : value to return if no value is contained
in both arrays. Default is '-1'
xor_flag = int : if this keyword is set, the function returns
only those values with are present in either
one or the other array, but not in both.
Description:
intersect two arrays and return values that are present in
both arrays or (if xor_flag is set) in exactly one of the two.
Return value:
a result array or (if empty) nodata
int count=count  : number of elements in the resulting array
Example code:
x = [0,2,3,4,6,7,9]
y = [3,6,10,12,20]
print intersection of x and y
print,intersect(x,y)
3        6
print xor elements
print,intersect(x,y,/xor_flag)
0       2       4       7       9      10      12      20
print values in x that are not in y
xyu=intersect(x,y,/xor_flag) & print,intersect(x,xyu)
0       2       4       7       9

Last modified: Mon Nov 29 13:30:05 2004