MATLAB Answers

CELL2MAT does not support cell arrays containing cell arrays or objects.

12 views (last 30 days)
Berney Li
Berney Li on 22 Feb 2020
Commented: Walter Roberson on 9 Mar 2020
hello guys.Can you understand Chinese?The sentence in blue means that "CELL2MAT does not support cell arrays containing cell arrays or objects".I never see any error like this.I translated it into English by Google Translator.So it may be not accurate.Do anyone experience this error.Could you please tell me how to do?By the way,my MATLAB version is R2019b,the code is earlier.So i think whether the old version and the new version are incompatible.I think the code itself don't have grammatical errors.Thank you for your answer!


Show 9 older comments
Berney Li
Berney Li on 8 Mar 2020
Hello,i can't solve it until now.I think I don't have enough capicity to
cope with it,Could you please help me?All codes are aviliable except only one error I mentioned.All codes are attached.Only I opened,It happened an error.Hope your help.Thank you.
Walter Roberson
Walter Roberson on 9 Mar 2020
That model was designed for MATLAB R13SP1, which was from 2003. It is not surprising that it does not work in current releases.

Sign in to comment.

Answers (1)

Guillaume on 23 Feb 2020
Edited: Guillaume on 24 Feb 2020
Indeed cell2mat does not support converting a cell array containing objects into a matrix. It looks like your cell array contains axes handles. Prior to R2014b axes handles used to be plain numbers so indeed you could convert a cell array of axes handles to a matrix. From R2014b, axes handles are objects and the error would appear.
Without knowing the exact details of what is in your cell array (shape and size) it's not easy to tell you how to solve the problem. Hence why Walter asked you to run the celldisp, so we could see what's in there.
Assuming that each cell contains a single axes handle, or row vectors of axes handles, then:
axes_mat = [ax_cell{:}];
If the cells contain column vectors/of axes handles:
axes_mat = vertcat(ax_cell{:});
If they contain 2D or ND matrix, it will be more complicated.
edit: following the output of celldisp being shown:
Since the cell array contains scalar axes handles, any of the above would work.

  1 Comment

Sign in to comment.

Sign in to answer this question.