Matlab cell2mat error
Show older comments
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 Comments
Steven Lord
on 7 Nov 2016
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
on 11 Nov 2016
Edited: Walter Roberson
on 12 Nov 2016
Walter Roberson
on 12 Nov 2016
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
on 11 Jan 2017
Ahmed Ali
on 4 Jul 2019
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);
Accepted Answer
More Answers (2)
Abhinav Gurram
on 11 Nov 2016
0 votes
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 Comment
Walter Roberson
on 12 Jan 2017
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
on 12 Jan 2017
Edited: Dae Woo Park
on 12 Jan 2017
0 votes
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!