Products & Services Industries Academia Support User Community Company

Learn more about Statistics Toolbox   

unique - Class: categorical

Unique values in categorical array

Syntax

B = unique(A)
[B,I,J] = unique(A)
[B,I,J] = unique(A,'first')

Description

B = unique(A) returns a categorical array containing the unique elements of A, sorted by the order of A's levels.

[B,I,J] = unique(A) also returns index vectors I and J such that B = A(I) and A = B(J).

[B,I,J] = unique(A,'first') returns the vector I to index the first occurrence of each unique value in A. unique(A,'last'), the default, returns the vector I to index the last occurrence.

See Also

intersect, ismember, setdiff, setxor, union

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS