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.
类别
在 帮助中心 和 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!