| Contents | Index |
Unique values in categorical array
Note In a future release, the behavior of categorical.unique will change to be consistent with the MATLAB function unique. This behavior change is optional in R2012a. For a demonstration of using the 'R2012a' flag to preview the future behavior, or the 'legacy' flag to preserve the current behavior in your existing code, see the documentation for unique. |
C = unique(A)
[C,IA,IC] = unique(A)
[...] = unique(A,'rows')
[...] = unique(A,occurrence)
[...]
= unique(A,'rows',occurrence)
[...] = unique(...,'R2012a')
[...] = unique(...,'legacy')
[...] = unique(A,setOrder)
[...]
= unique(A,'rows',setOrder)
C = unique(A) returns a categorical array containing the same values as in A but with no repetitions. C is sorted by the order of A's levels.
[C,IA,IC] = unique(A) also returns index vectors IA and IC such that C = A(IA) and A = C(IC).
[...] = unique(A,'rows') for the categorical matrix A returns the unique rows of A. The rows of the matrix C are sorted by the order of A's levels. The optional outputs IA and IC are index vectors such that C = A(IA,:) and A = C(IC,:).
[...] = unique(A,occurrence) and [...] = unique(A,'rows',occurrence) specify which index is returned in IA in the case of repeated values or rows in A. The default value is occurrence='last', which returns the index of the last occurrence of each repeated value or row in A. occurrence='first' returns the index of the first occurrence of each repeated value or row in A.
[...] = unique(...,'R2012a') adopts the future behavior of unique. You can specify the flag as the final argument with any previous syntax that accepts A, 'rows', or occurrence.
[...] = unique(...,'legacy') preserves the current behavior of unique. You can specify the flag as the final argument with any previous syntax that accepts A, 'rows', or occurrence.
[...] = unique(A,setOrder) and [...] = unique(A,'rows',setOrder) returns the values or rows of C in a specific order. setOrder='sorted' returns the values or rows of C in sorted order. setOrder='stable' returns the values or rows of C in the same order as A. If A is a row vector, then C is also a row vector. Otherwise, C is a column vector. IA and IC are column vectors. If there are repeated values in A, then IA returns the index of the first occurrence of each repeated value.
intersect | ismember | setdiff | setxor | union
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |