error in working with cell array

조회 수: 1 (최근 30일)
Razieh
Razieh 2015년 5월 6일
댓글: Nobel Mondal 2015년 5월 6일
I see this error:
??? Error using ==> cell2mat at 53 Cannot support cell arrays containing cell arrays or objects
when I define:
C is cell array result={A; B; C}; mydatamat=cell2mat(result);
So, what is the solution?
  댓글 수: 1
Nobel Mondal
Nobel Mondal 2015년 5월 6일
cell2mat function doesn't support a nested cell array within the input cell array.
It seems you have to convert C first into numeric, char or struct datatype depending on your data validity. Could you please give some info/pattern on how your A,B and C variables look like?

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

답변 (1개)

David Sanchez
David Sanchez 2015년 5월 6일
hi,
transform C into a matrix before concatenating A, B and C in result:
C = cell2mat(C);
result={A; B; C};
mydatamat=cell2mat(result);
A and B have to be matrices too.
  댓글 수: 1
David Sanchez
David Sanchez 2015년 5월 6일
your attempt to create your data matrix does not work because you are trying to apply cell2mat to a cell of cells: result is a cell containing (at least), another cell ( C ).

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

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by