Matlab cell2mat error

조회 수: 8 (최근 30일)
Dae Woo Park
Dae Woo Park 2016년 11월 7일
댓글: Ahmed Ali 2019년 7월 4일
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
Walter Roberson
Walter Roberson 2017년 1월 12일
... emailed.

댓글을 달려면 로그인하십시오.

추가 답변 (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 Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by