how to reshape cell array

60 vues (au cours des 30 derniers jours)
Meggie Hwang
Meggie Hwang le 19 Jan 2016
Commenté : Meggie Hwang le 19 Jan 2016
I have a 1x4620 cell array and every element is a 7x7x4 3D matrix. What should I do if I want convert this cell 1x4620 to 77x60 cell array.
  2 commentaires
jgg
jgg le 19 Jan 2016
Why does this:
c = cell(4620,1)
d = reshape(c,[77,60])
Not work?
Meggie Hwang
Meggie Hwang le 19 Jan 2016
thank you. It's work! I just tried reshape(c,{77,60}) and it's failure. ha ha......

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 19 Jan 2016
Use reshape
newCa = reshape(ca, 77, 60);
The contents of the cell don't matter - they don't enter into it at all. See the FAQ: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F
  2 commentaires
Image Analyst
Image Analyst le 19 Jan 2016
P.S. A cell array take up an enormous amount of overhead memory as compared to a double array. You should consider just using a 4D array of doubles instead of a cell array.
Meggie Hwang
Meggie Hwang le 19 Jan 2016
thanks for ur help!!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices 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