Converting cell to 3 dimensional matrix

72 vues (au cours des 30 derniers jours)
Pankaj
Pankaj le 25 Fév 2017
Commenté : Stephen23 le 22 Mar 2023
I have a cell of size [1, 50] each of it is 11 x 2 matrix.
I would like it to convert it to a 3-d matrix of size 11 X 2 X 50.
How it can be done? Cane it be done using reshape?
Thanks

Réponse acceptée

Stephen23
Stephen23 le 25 Fév 2017
Modifié(e) : Stephen23 le 25 Fév 2017
If C is your cell array:
cell2mat(permute(C,[1,3,2]))
or
cell2mat(reshape(C,1,1,[]))
or
cat(3,C{:})
  2 commentaires
Giovanni Bambini
Giovanni Bambini le 22 Mar 2023
And what if I want a50x11x2?
Stephen23
Stephen23 le 22 Mar 2023
"And what if I want a50x11x2?"
permute(cat(3,C{:}),[3,1,2])

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Convert Image Type 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