Skip to content

ismember

set · scripts/set/ismember.m

tf = ismember (A, S)
tf = ismember (A, S, "rows")
[tf, loc] = ismember (...)

Test which elements of A (or which rows, with "rows") occur in S.

"tf" is a logical array the size of A (a column with "rows").  "loc" holds
the lowest index into S(:) (row number with "rows") of a matching element,
or 0.  With the option "legacy" the highest index is reported instead.
NaN is never a member.  Options are matched case-insensitively.