NUMUNIQUE

版本 1.6.0.0 (4.4 KB) 作者: Zhigang Xu
Returns unique elements in an array and all the indices for the repetitious values.
770.0 次下载
更新时间 2009/9/5

查看许可证

[B P]=numunique(A) for the array A returns the same values as in A but
with no repetitions. B will also be sorted. A can only be numerical,
as the name of the function suggests.

The second output, P, is a row of cells, containing the indices of A,
such that, A(p{n})=B(n) is true. P has the same number of cells as the
number of elements in B.

Note that each cell of P lists all the indices of A, not only the first
or last occurrence, which have the repetitious values. This is different to the Mathwork's
function UNIQUE. Sometimes we need to know all the indices of which A have the same values.

引用格式

Zhigang Xu (2024). NUMUNIQUE (https://www.mathworks.com/matlabcentral/fileexchange/25209-numunique), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2008b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Operators and Elementary Operations 的更多信息

Community Treasure Hunt

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

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

Suggestions from Matt Fig and Bruno Luong, and the case of unique values only are implemented. A third optional output is implemented in case one also needs the representative indices, which are chosen as those for the first occurrences.

1.5.0.0

Suggestions from Matt Fig and Bruno Luong are implemented. A third optional output is implemented in case one also needs the representative indices, which are chosen as those for the first occurrences.

1.4.0.0

Correction also for the same typos but appeared in the General Information about the file.

1.2.0.0

Correction for the two minor typos in the help text.

1.1.0.0

There was a bug and now it has been fixed.

1.0.0.0