uniquetol
Unique values within tolerance
Syntax
Description
returns
the unique elements in C = uniquetol(A,tol)A using tolerance tol.
Two values, u and v, are within
tolerance if
abs(u-v) <= tol*max(abs(A(:)))
That is, uniquetol scales the tol input
based on the magnitude of the data.
uniquetol is similar to unique.
Whereas unique performs exact comparisons, uniquetol performs
comparisons using a tolerance.
,
where C = uniquetol(A,tol,occurrence)occurrence is 'highest', specifies
that when several values are within tolerance of each other, the highest value
should be selected as being unique. The default for
occurrence is 'lowest', which selects
the lowest value as being unique.
[___] = uniquetol(___, uses
additional options specified by one or more Name-Value pair arguments
using any of the input or output argument combinations in previous
syntaxes. For example, Name,Value)uniquetol(A,'ByRows',true) determines
the unique rows in A.
Examples
Input Arguments
Name-Value Arguments
Output Arguments
Algorithms
uniquetol sorts the input lexicographically, and then starts at
the lowest or highest value to find unique values within tolerance. As a result,
changing the sorting of the input could change the output. For example,
uniquetol(-A) might not give the same results as
-uniquetol(A).
There can be multiple valid C outputs that satisfy the condition,
no two elements in C are within tolerance of each
other. The uniquetol function can return several of
the valid outputs, depending on whether the value of occurrence is
'highest' or 'lowest' and whether the
PreserveRange option is specified.
Extended Capabilities
Version History
Introduced in R2015aSee Also
unique | isapprox | ismembertol | ismember | eps

