uniquify

版本 1.0.0.0 (1.8 KB) 作者: Yair Altman
Ensures a given set of values is unique (adds a very small number to duplicate values)
1.9K 次下载
更新时间 2007/8/28

无许可证

Some Matlab functions (e.g., interpolation) require their inputs to be a unique set of values. UNIQUIFY ensures that a given data vector is unique by adding very small numbers to duplicate entries in the input.

UNIQUIFY does NOT sort the values, contrary to Matlab's unique() function - it just slightly modifies any duplicate values. The data remains in its original order.

Example:
vals = uniquify([1,1,1]) -1; => [0, 2.22e-16, 4.44e-16]

Algorithm:
loop over all duplicate entries, adding eps*2^iter in each iteration until the entire data vector is unique.

See also:
unique, interp1, consolidate (on the File Exchange)

引用格式

Yair Altman (2024). uniquify (https://www.mathworks.com/matlabcentral/fileexchange/16098-uniquify), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R12
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Develop Apps Using App Designer 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0

Improved performance & accuracy; fixed runaway exponential deltas; fixed single/double support; added comments