MATLAB: Cannot support cell arrays containing cell arrays or objects.

cell arraysunique

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?

Best Answer

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