Cell contents reference from a non-cell array object error
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have a code for selecting regions of interest on an image, create a mask and then apply this mask to the matrices in a cell array. The problem that is occurring is that Matlab says the cell contents reference a non-cell array object.
Cell contents reference from a non-cell array object.
Error in hopefully_the_last_window>pushbutton3_Callback (line 191)
Y = X{i}.*mask;
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in hopefully_the_last_window (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
@(hObject,eventdata)hopefully_the_last_window('pushbutton3_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
I read on another answer on Mathworks that changing the {} brackets in my code to standard brackets () would fix this error ( changing Y = X{i}.*mask to Y = X(i).*mask). When I did this Matlab simply froze and stopped responding. Is this fix a decent solution to the error with some tweaks to stop matlab freezing or is there another possible cause of the error than the bracket?
0 Commenti
Risposte (1)
Jan
il 10 Ago 2017
Look at the code:
X = handles.finishCell;
mask = labeledImage;
for i = 1 : numel(X)
Y = X{i}.*mask;
end
We cannot know, what the contents of "handles.finishCell" is. The error message tells clearly, that it is not a cell array. Then simply using round parenthesis is pure guessing. You have to find out, what the contents of this variable is. Do not apply a solution, which was posted for perhaps a completely different problem.
Note that Y is overwritten in each iteration. Perhaps you want Y{i} also. Then some lines later:
handles.X = Y{i};
Are you sure, that you want the last element of Y only?
0 Commenti
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!