<< sum | Data analysis |
C = unique(A) |
C = unique(A, 'rows') |
[C, ia, ic] = unique(...) |
an nelson's variable (double, single, int8, int16, int32, int64, uint8, uint16, uint32, uint64, logical, char, string, cell).
Unique data of A.
Index to A: column vector.
Index to C: column vector.
C = unique(A) returns the unique elements of array A in sorted order.
C = unique(A, 'rows') considers each row of A as a unique entity and returns the unique rows in sorted order.
Note that the 'rows' option does not support cell arrays.
[C, ia, ic] = unique(...) extends any of the previous syntaxes to also return index vectors ia and ic.
For a vector A, the relationships are C = A(ia) and A = C(ic).
For a matrix or array A, the relationships are C = A(ia) and A(:) = C(ic).
If the 'rows' option is used, the relationships are C = A(ia, :) and A = C(ic, :).
A = [10+20i 30+i 10i 0 -10i];
[C, ia, ic] = unique(A)
A = {'hi', 'good'; 'good', 'tell'; 'hi', 'bye'}
[C, ia, ic] = unique(A)
sort.
Version | Description |
---|---|
1.6.0 | initial version |
Allan CORNET