how to reshape cell array

조회 수: 48 (최근 30일)
Meggie Hwang
Meggie Hwang 2016년 1월 19일
댓글: Meggie Hwang 2016년 1월 19일
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
jgg
jgg 2016년 1월 19일
Why does this:
c = cell(4620,1)
d = reshape(c,[77,60])
Not work?
Meggie Hwang
Meggie Hwang 2016년 1월 19일
thank you. It's work! I just tried reshape(c,{77,60}) and it's failure. ha ha......

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2016년 1월 19일
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
Image Analyst
Image Analyst 2016년 1월 19일
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 2016년 1월 19일
thanks for ur help!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by