Matlab cell2mat error
5 ビュー (過去 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 件のコメント
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);
採用された回答
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 件のコメント
その他の回答 (2 件)
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
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.
参考
カテゴリ
Help Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!