union
Set union of two arrays.
📝Syntax
C = union(A, B)
[C, ia, ib] = union(A, B)
📥Input Arguments
Parameter Description
A, B Input arrays.
📤Output Arguments
Parameter Description
C Sorted values that are in A or B.
ia, ib Index vectors into A and B.
📄Description

union(A, B) returns the sorted set of values that occur in either input array.

💡Examples
A = [5 7 1];
B = [3 1 1];
C = union(A, B)
🔗See Also
intersectsetdiffsetxor
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub