Unique function of MATLAB--to find the uniqueness of array matrix
Related Mathwork documentation See this:unique values in a unique array
1 C = unique(A) . Returns the A same data as in, but does not contain duplicates. Chave been sorted by small to large.
2. C = unique(A,___,‘rows‘) and C = unique(A,‘rows‘,___) A each row in is treated as a single entity, and A the unique row in the sort order is returned. Must be specified A , setOrder and occurrence is optional.
‘rows‘option does not support cellular arrays.
3, you [C,ia,ic] = unique(___) can also use any of the above syntax to return the index vector ia and ic .
-
if a is a vector, then c = A (ia) and a = C (IC) .
-
if a is a matrix or array, then c = A (ia) and a (:) = C (IC) .
-
"rows" option, then c = A (ia,:) and a = C (IC,:) .
-
if a is a table or timesheet, then c = A (ia,:) and a = C (IC,:) .
4. [C,ia,ic] = unique(A,‘legacy‘) ,
[C,ia,ic] = unique(A,‘rows‘,‘legacy‘)、
[C,ia,ic] = unique(A,occurrence,‘legacy‘)And
[C,ia,ic] = unique(A,‘rows‘,occurrence,‘legacy‘)Preserves the behavior of functions in r2012b and earlier versions unique .
‘legacy‘The option does not support categorical arrays, datetime arrays, duration arrays, tables, or timesheets.
Only IA and ICS are returned:
Unique function of MATLAB--the uniqueness value of array matrix