C = uniquetol(A)
C = uniquetol(A, tol)
C = uniquetol(___, name, value)
[C, ia, ic] = uniquetol(___)
| Parameter | Description |
|---|---|
| A | real full array of type single or double. |
| tol | nonnegative scalar tolerance. The default is 1e-12 for double and 1e-6 for single inputs. Two values u and v are within tolerance if abs(u-v) <= tol*DataScale. |
| name, value | one or more name-value pairs: 'ByRows' (logical, treat each row of A as a single element), 'OutputAllIndices' (logical, return ia as a cell array holding every index of each group), 'DataScale' (scalar or per-column vector used instead of the automatic scaling). |
| Parameter | Description |
|---|---|
| C | unique values of A within tolerance, sorted in ascending order. |
| ia | index vector such that C = A(ia). When 'OutputAllIndices' is true, ia is a cell array where ia{k} lists every index of A belonging to the k-th group. |
| ic | index vector such that A is within tolerance of C(ic). |
uniquetol returns the unique values of A using tolerance tol. Two elements are considered equal when their absolute difference is less than or equal to tol scaled by the data. By default the scaling is the largest absolute value of A, or the largest absolute value of each column when 'ByRows' is true.
The output C is sorted in ascending order and, for each group of nearby values, keeps the smallest one.
[C, ia, ic] = uniquetol([2 1 2 1.0000001], 1e-6)
| Version | Description |
|---|---|
| 2.0.0 | initial version |