Matlab cell2mat error

6 次查看(过去 30 天)
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 个评论
Dae Woo Park
Dae Woo Park 2017-1-11
I attache the code. You can find errors by running VUESR. This code only works on Matlab 2014a and you can check it. Could you change this code to work all the version of Matlab?
Regards
Dae Woo
Ahmed Ali
Ahmed Ali 2019-7-4
Good evening
I can not help you
Thank you very much
ffff.JPG
Undefined variable "xldata" or class "xldata.treat".
Error in main_disease_classification (line 21)
treat = uipanel.cell2mat(xldata.treat);

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2017-1-12
编辑:Walter Roberson 2017-1-12
I had to make a lot of changes to the code. I made the first batch of fixes against R2014a; I marked those in the code with 'WDR'. I then moved over to a new release and fixed the cell2mat problems that you had posted about; those are also marked with 'WDR' in the code.
For example, the code assumes that some ultrasound information is present in the dicom information; I removed that limitation. Also, I removed the assumption that the ocr() routine is available (it requires a new-ish version of the Computer Vision toolbox.)
From R2014b onwards, the colormap changing did not work, because colormaps now depend on the axes. I fixed that.
From R2014b onwards, the majority of the callbacks that you had defined failed. You have them defined as methods of VUESR so they were marked as belonging only to VUESR objects. However, graphics callback get invoked with graphics objects as the first parameter, and the way MATLAB determines which object a routine is to be looked up against in a call is by scanning for the first object from the left in the parameter list. Therefore for normal graphics callbacks, you need routines that are either outside of any class, or are derived from the graphics system. The fix was to move "tool" to be the first parameter of all of the graphics callbacks (including adding it as a parameter to a couple of routines it was not passed to before) and adjusting the calling sequence of all of the callback anonymous functions to insert tool as the first parameter. This was a fair bit of editing, and I did not mark the changes.
After that I did more testing and fixed some bugs, mostly relating to the assumption that there were multiple images available.
  3 个评论
Dae Woo Park
Dae Woo Park 2017-1-12
If you cannot, you can just mail me your revision to this email: bigrain@umich.edu
Thank you

请先登录,再进行评论。

更多回答(2 个)

Abhinav Gurram
Abhinav Gurram 2016-11-11
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
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
Dae Woo Park 2017-1-12
编辑:Dae Woo Park 2017-1-12
Thank you for your kind help. Could you mail me (<mailto:bigrain@umich.edu bigrain@umich.edu>) or attach here your revised code?
Regards
Dae Woo

类别

Help CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by