| MATLAB Function Reference | Search  Help Desk |
| unique | Examples See Also |
b = unique(a) b = unique(A,'rows') [b,i,j] = unique(...)
b = unique(a)
returns the same values as in a but with no repetitions. The resulting vector is sorted in ascending order. a can be a cell array of strings.
b = unique(A,'rows')
returns the unique rows of A.
[b,i,j] = unique(...)
also returns index vectors i and j such that b = a(i) and a = b(j) (or b = a(i,:) and a = b(j,:)).
a = [1 1 5 6 2 3 3 9 8 6 2 4] a = 1 1 5 6 2 3 3 9 8 6 2 4 [b,i,j] = unique(a) b = 1 2 3 4 5 6 8 9 i = 2 11 7 12 3 10 9 8 j = 1 1 5 6 2 3 3 8 7 6 2 4 a(i) ans = 1 2 3 4 5 6 8 9 b(j) ans = 1 1 5 6 2 3 3 9 8 6 2 4
intersect Set intersection of two vectors
ismember True for a set member
setdiff Return the set difference of two vectors
setxor Set exclusive-or of two vectors
union Set union of two vectors