Matlab cell2mat error
이전 댓글 표시
Hi,
I have a following error when I use Matlab 2012b and 2016a. "Error using cell2mat (line 52) CELL2MAT does not support cell arrays containing cell arrays or objects." However, I do not have this error in Matlab 2014a. Does anyone have idea why this happens?
Thank you
댓글 수: 5
Steven Lord
2016년 11월 7일
Can you post a small sample of code with which you can reproduce this problem and/or a MAT-file containing the cell array you passed into cell2mat?
Dae Woo Park
2016년 11월 11일
편집: Walter Roberson
2016년 11월 12일
Walter Roberson
2016년 11월 12일
We need to know more about tool.handles.Panels and how it is constructed.
What do you find when you explore the difficulty with the debugger? What is the struct2cell(tool.handles.Panels) returning when you get the failure?
Dae Woo Park
2017년 1월 11일
Ahmed Ali
2019년 7월 4일
Good evening
I can not help you
Thank you very much

Undefined variable "xldata" or class "xldata.treat".
Error in main_disease_classification (line 21)
treat = uipanel.cell2mat(xldata.treat);
채택된 답변
추가 답변 (2개)
Abhinav Gurram
2016년 11월 11일
0 개 추천
It might very well be possible that the data you are trying to convert is not supported by the cell2mat function. cell2mat takes as input a cell array, in which all cells contain the same data type. The input cell array can contain numeric or character data within cells, or structures with the same field names and data types. However, cell2mat currently does not, nor has it ever accepted objects or nested cells within the input cell array. If your cell array contains objects or nested cells, this could be a possible reason for why you are seeing the error.
However, if your data is not in the form of objects or nested cells, it would be helpful if you can provide a sample of code that will help us reproduce this issue. I'm particularly interested to know why the code fails on R2012a and R2016a versions of MATLAB, but works fine on R2014a.
Cheers!
댓글 수: 1
Walter Roberson
2017년 1월 12일
The code was creating a cell array each member of which is a uipanel object. cell2mat refuses to work with objects because objects cannot in general be concatenated. Potentially cell2mat could be enhanced to check ishghandle and allow the cell2mat in that case.
Dae Woo Park
2017년 1월 12일
편집: Dae Woo Park
2017년 1월 12일
0 개 추천
카테고리
도움말 센터 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!