Reputation: 43
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?
Upvotes: 3
Views: 568
Reputation: 342
A{1} = {'aa','b','d','aa'};
A{2} = {'c','d','aa'};
A{3} = {'bb','aa','bb','aa'};
unique([A{:}])
There you go. The {:}
, (:)
and []
operators are very useful in MATLAB. Get comfortable using them.
Upvotes: 2