Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How do I convert a 5x4cell to a 5x4matrix?

조회 수: 1 (최근 30일)
Sam
Sam 2015년 1월 6일
마감: MATLAB Answer Bot 2021년 8월 20일
In attachment is my example of the 5x4 cell. I want to create a 5x4 matrix of it. How do I do this?

답변 (2개)

Luuk van Oosten
Luuk van Oosten 2015년 1월 6일
Hi Sam, have you tried
M = cell2mat(C)
  댓글 수: 1
Sam
Sam 2015년 1월 6일
편집: Sam 2015년 1월 6일
Yes, it doesn't work... "Error using cat Dimensions of matrices being concatenated are not consistent.
Error in cell2mat (line 86) m = cat(2,m{:});"

Guillaume
Guillaume 2015년 1월 6일
Your 5x4 cell consists of vectors of different size totaling up 676 + 501 + ... + 358 = way more than 20 elements. A 5x4 matrix by definition only contains 20 elements.
In other words, what you want is not possible or you've not stated what you want correctly.
  댓글 수: 2
Sam
Sam 2015년 1월 6일
can I convert the 5x4cell to a 5x4struct?
Guillaume
Guillaume 2015년 1월 6일
편집: Guillaume 2015년 1월 6일
You can:
s = struct('somefieldname', C);
The cell is probably easier to manipulate though.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by