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

setdiff(A, B) returns the sorted values that occur in A but not in B.

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