How to use unique() in a cell array

24 ビュー (過去 30 日間)
Conner Carriere
Conner Carriere 2022 年 11 月 22 日
コメント済み: Conner Carriere 2022 年 11 月 22 日
I have a cell array that I need to find the individual names that come up
a =
91×1 cell array
{[roof-dent ]}
{2×1 categorical }
{[Sidemirror-Damage ]}
{[RunningBoard-Dent ]}
{3×1 categorical }
{[rear-bumper-dent ]}
{[rear-bumper-dent ]}
{2×1 categorical }
{[roof-dent ]}
{[Rear-windscreen-Damage ]}
{[RunningBoard-Dent ]}
{[Rear-windscreen-Damage ]}
{[Front-Windscreen-Damage]}
{[doorouter-dent ]}
{[rear-bumper-dent ]}
{[fender-dent ]}
{2×1 categorical }
{2×1 categorical }
{[bonnet-dent ]}
{[rear-bumper-dent ]}
{2×1 categorical }
The 2x1 and 3x1 also have the same data in them, just a possable other name. Is there a way to expand it, or use cellfun to use something like unique(a) on it?
I want an output like this
output = {'roof-dent','Sidemirror-Damage','RunningBoard-Dent'......}
basically what unique(a) would do, but its not working for this example.
attached is the data
  2 件のコメント
the cyclist
the cyclist 2022 年 11 月 22 日
Can you upload the actual data (or maybe just a smaller sample that could serve as an example), and also be specific about what output you expect?
Conner Carriere
Conner Carriere 2022 年 11 月 22 日
Uploaded and updated!

サインインしてコメントする。

採用された回答

the cyclist
the cyclist 2022 年 11 月 22 日
I'm not certain, but I believe what you want is
unique(vertcat(b{:}))
  1 件のコメント
Conner Carriere
Conner Carriere 2022 年 11 月 22 日
Correct, thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by