Skip to content

union

set · scripts/set/union.m

C = union (A, B)
C = union (A, B, "rows")
C = union (A, B, "sorted" | "stable" | "legacy")
[C, ia, ib] = union (...)

Distinct elements that occur in A or in B.

Options are matched case-insensitively and may be combined, except that
"sorted", "stable" and "legacy" are mutually exclusive.  The index outputs
are column vectors; "ia" refers to A, and "ib" to elements found only in B.