Skip to content

unique

set · scripts/set/unique.m

C = unique (A)
C = unique (A, option, ...)
[C, ia, ic] = unique (...)

Distinct elements of A (or distinct rows with "rows").

Options (case-insensitive): "rows", "sorted" (default), "stable", "first"
(default), "last" and "legacy".  "first"/"last" select which occurrence
"ia" reports.  The index outputs satisfy C = A(ia) and A(:) = C(ic)
(A(ia,:) and A = C(ic,:) for "rows") and are columns, except in "legacy"
mode where they follow the orientation of a row vector input and default
to the last occurrence.