Unique cell of MATLAB memory cell2mat
I created an array of arrays like this
A{1} = {'aa','b','d','aa'};
A{2} = {'c','d','aa'};
A{3} = {'bb','aa','bb','aa'};
now i want to find 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 am new to Matlab. Am I doing something wrong here?
+3
user4199101
source
to share
1 answer
A{1} = {'aa','b','d','aa'};
A{2} = {'c','d','aa'};
A{3} = {'bb','aa','bb','aa'};
unique([A{:}])
There you go. Operators {:}
, (:)
and are []
very useful in MATLAB. It is convenient to use them.
+2
Akshay rao
source
to share