Language Reference


XSECT Function

XSECT (matrix1 <, matrix2, …, matrix15> );

The XSECT function returns as a row vector the sorted set (without duplicates) of the element values that are present in all of its arguments. This set is the intersection of the sets of values in its argument matrices. When the intersection is empty, the XSECT function returns an empty matrix with zero rows and zero columns. There can be up to 15 arguments, which must all be either character or numeric.

For characters, the element length of the result is the same as the shortest of the element lengths of the arguments. For comparison purposes, shorter elements are padded on the right with blanks.

For example, the following statements computes the intersection of two sets:

a = {1 2 4 5};
b = {3 4};
c = xsect(a,b);
print c;

Figure 24.434: Set Intersection

c
4