FUNCTION REFERENCE
ismember
Test set membership.
Test set membership.
Syntax
tf = ismember(A, B)Syntax
[tf, loc] = ismember(A, B)Syntax
[tf, loc] = ismember(A, B, 'rows')tf marks elements of A found in B. loc is the first index in B, or 0. NaN never matches.
Example
[tf, loc] = ismember([1 7], [5 6 1]) % tf = [true false], loc = [3 0]Differences from MATLAB: Numeric/logical inputs support 2-D arrays with 'rows' (not 'legacy'). Character/cellstr forms also support 'legacy'; 'rows' warns and is ignored for cell inputs.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.