uniqueCellGeneraliz​ed(A)

Unique elements in cell array containing mixed-type elements
36 Downloads
Aktualisiert 30 Mai 2017

Lizenz anzeigen

[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]

Zitieren als

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

Kompatibilität der MATLAB-Version
Erstellt mit R2015a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Tables finden Sie in Help Center und MATLAB Answers
Tags Tags hinzufügen
Quellenangaben

Inspiriert von: Unique elements in cell array

Inspiriert: uniqueCells

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.2.0.0

Updated text

1.1.0.0

Added examples

1.0.0.0