FUNCTION REFERENCE
intersect
Values common to two sets.
Values common to two sets.
Syntax
C = intersect(A, B)Syntax
[C, ia, ib] = intersect(A, B, 'stable')Syntax
[C, ia, ib] = intersect(A, B, 'rows')Result is sorted by default; 'stable' keeps the order of A. ia and ib are first indices.
Example
intersect([1 2 3], [2 3 4]) % [2 3]Differences from MATLAB: Numeric/logical inputs support 2-D arrays with 'rows', 'sorted', or 'stable' (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.