Cannot support cell arrays containing cell arrays or objects.

14 vues (au cours des 30 derniers jours)
Carina
Carina le 30 Oct 2014
Commenté : TraxexFly le 13 Oct 2016
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?

Réponse acceptée

Sean de Wolski
Sean de Wolski le 30 Oct 2014
You can use comma-separated list expansion here:
B = [A{:}]
  2 commentaires
Carina
Carina le 30 Oct 2014
Thanks
TraxexFly
TraxexFly le 13 Oct 2016
thank you you save my day

Connectez-vous pour commenter.

Plus de réponses (1)

Orion
Orion le 30 Oct 2014
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.

Catégories

En savoir plus sur Cell Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by