uniqueCellGeneraliz​ed(A)

Unique elements in cell array containing mixed-type elements

現在この提出コンテンツをフォロー中です。

[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 (2026). uniqueCellGeneralized(A) (https://jp.mathworks.com/matlabcentral/fileexchange/63177-uniquecellgeneralized-a), MATLAB Central File Exchange. に取得済み.

謝辞

ヒントを得たファイル: Unique elements in cell array

ヒントを与えたファイル: uniqueCells

カテゴリ

Help Center および MATLAB AnswersTables についてさらに検索

一般的な情報

MATLAB リリースの互換性

  • すべてのリリースと互換性あり

プラットフォームの互換性

  • Windows
  • macOS
  • Linux
バージョン 公開済み リリース ノート Action
1.2.0.0

Updated text

1.1.0.0

Added examples

1.0.0.0