MATLAB Function Reference    
unique

Unique elements of a vector

Syntax

Description

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). Each element of i is the greatest subscript such that b = a(i). For row combinations, b = a(i,:) and a = b(j,:).

Examples

See Also

intersect, ismember, setdiff, setxor, union


 union unix