MATLAB Functions Help Desk

unique

Purpose

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 nonvector input array is regarded as the column vector a = A(:).

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 ]