| MATLAB Functions | Help Desk |
setdiff
Return the set difference of two vectors
c = setdiff(a,b) c = setdiff(a,b,'rows') [c,i] = setdiff(...)
c = setdiff(a,b)
returns the values in a that are not in b. The resulting vector is sorted is ascending order. In set theoretic terms, c = a - b.
c = (a,b,'rows')
when a and b are matrices with the same number of columns returns the rows from a that are not in b.
[c,i] = setdiff(...)
also returns an index vector index such that c = a(i) or c = a(i,:).
A non-vector input array A is regarded as a column vector A(:).
A = magic(5); B = magic(4); [c,i] = setdiff(A,B); c' = 17 18 19 20 21 22 23 24 25 i' = 1 10 14 18 19 23 2 6 15
intersect Set intersection of two vectors
ismember True for a set member
setxor Set exclusive-or of two vectors
union Set union of two vectors
unique Unique elements of a vector