intersect
Set intersection of two arrays.
📝Syntax
C = intersect(A, B)
[C, ia, ib] = intersect(A, B)
📥Input Arguments
Parameter Description
A, B Input arrays.
📤Output Arguments
Parameter Description
C Sorted values common to A and B.
ia, ib Index vectors into A and B.
📄Description

intersect(A, B) returns the sorted values that occur in both input arrays.

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