MATLAB Function Reference
  Go to function:
    Search    Help Desk 
unique    Examples   See Also

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) (or b = a(i,:) and a = b(j,:)).

Examples

See Also

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



[ Previous | Help Desk | Next ]