UNION Function

UNION( matrix1 <, matrix2, ..., matrix15> ) ;

The UNION function returns as a row vector the sorted set (without duplicates) which is the union of the element values present in its arguments. There can be up to 15 arguments, which can be either all character or all numeric. For character arguments, the element length of the result is the longest element length of the arguments. Shorter character elements are padded on the right with blanks.

This function is identical to the UNIQUE function.

The following statements produce the output shown:

   a={1 2 4 5};
   b={3 4};
   c=union(a,b);
      C             1 row       5 cols    (numeric)

            1         2         3         4         5

The UNION function can be used to sort elements of a matrix when there are no duplicates by calling UNION with a single argument.