Navigation

Operators and Keywords

Function List:

C++ API

: c = union (a, b)
: c = union (a, b, "rows")
: [c, ia, ib] = union (…)

Return the unique elements that are in either a or b sorted in ascending order.

If a and b are both row vectors then return a row vector; Otherwise, return a column vector. The inputs may also be cell arrays of strings.

If the optional input "rows" is given then return rows that are in either a or b. The inputs must be 2-D matrices to use this option.

The optional outputs ia and ib are index vectors such that a(ia) and b(ib) are disjoint sets whose union is c.

See also: unique, intersect, setdiff, setxor, ismember.

Package: octave