uniqueCellGeneraliz​ed(A)

版本 1.2.0.0 (3.2 KB) 作者: Dave Stanley
Unique elements in cell array containing mixed-type elements
36.0 次下载
更新时间 2017/5/30

查看许可证

[C,ia,ic] = uniqueCellGeneralized(A)
Same as the built in unique function, but works for cell arrays containing any type of data or a mixture of different data types (e.g. numerics, strings, function handles, objects, etc)

Example 1:
A = {{'a','b','c'}, {'a','b','c'}, {'d','e','f'}};
[C,ia,ic] = uniqueCellGeneralized(A)

Result1:
C = {{'a','b','c'}, {'d','e','f'}};
ia = [1 3]
ic = [1 1 2]

Example 2:
A = {{'a','b','c'},{'a','b','c'},{'d','e','f'},{@plot},{52},{51},{52}};
[C,ia,ic] = uniqueCellGeneralized(A)

Result 2:
C = {{'a','b','c'}, {'d','e','f'}, {@plot}, {52}, {51}};
ia = [1 3 4 5 6]
ic = [1 1 2 3 4 5 4]

引用格式

Dave Stanley (2024). uniqueCellGeneralized(A) (https://www.mathworks.com/matlabcentral/fileexchange/63177-uniquecellgeneralized-a), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2015a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Tables 的更多信息
标签 添加标签
致谢

参考作品: Unique elements in cell array

启发作品: uniqueCells

Community Treasure Hunt

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

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

Updated text

1.1.0.0

Added examples

1.0.0.0