FUNCTION REFERENCE
union
Combine two sets.
Combine two sets.
Syntax
C = union(A, B)Syntax
[C, ia, ib] = union(A, B, 'stable')Syntax
[C, ia, ib] = union(A, B, 'rows')Result is sorted by default; 'stable' keeps input order.
Example
union([1 2], [2 3]) % [1 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.