Cannot support cell arrays containing cell arrays or objects.

I created a cell Array like this
A{1} = {'aa','b','d','aa'};
A{2} = {'c','d','aa'};
A{3} = {'bb','aa','bb','aa'};
now i wanna find the unique words
b=cell2mat(A)
unique(b)
but i get this Error: Error using cell2mat (line 52) Cannot support cell arrays containing cell arrays or objects.
I'm fairly new to matlab. Am I doing something wrong here?

 採用された回答

Sean de Wolski
Sean de Wolski 2014 年 10 月 30 日

7 投票

You can use comma-separated list expansion here:
B = [A{:}]

2 件のコメント

Carina
Carina 2014 年 10 月 30 日
Thanks
TraxexFly
TraxexFly 2016 年 10 月 13 日
thank you you save my day

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

その他の回答 (1 件)

Orion
Orion 2014 年 10 月 30 日

0 投票

Hi,
the aim of cell2mat is to convert a cell that contains numbers into an array (matrix).
your cell contains strings, so it can't work.

カテゴリ

ヘルプ センター および File ExchangeCell Arrays についてさらに検索

質問済み:

2014 年 10 月 30 日

コメント済み:

2016 年 10 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by