Error while evaluating DestroyedObject Callback.
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Cesar Ramirez
am 3 Mär. 2019
Kommentiert: Cesar Ramirez
am 4 Mär. 2019
Hello everyone, I'm having an error while I activate my Android's Camera, basically I have this code, and it works, but when a press the button X from the window.
This is the code I'm using to activate my camera.
url = 'http://192.168.0.3:8080/shot.jpg';
ss = imread(url);
fh = image(ss,'Parent',handles.axes1);
while(1)
ss = imread(url);
set(fh,'CData',ss);
drawnow;
end
This is the error:
Error using matlab.graphics.primitive.Image/set
Invalid or deleted object.
Error in imagen>actdrd_Callback (line 584)
set(fh,'CData',ss);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in imagen (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)imagen('actdrd_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating DestroyedObject Callback.
I think the error is the while, but I don't know how to fix it, I tried it, I new on matlab. I hope you can help. Thanks.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 4 Mär. 2019
You have an infinite loop. I think you probably attempt to get out of the loop by closing the figure: if you do that then the axes would get deleted and the image would get deleted, making it impossible to update the CData property.
If you want to be able to close the figure then you need to be testing for the image object having been deleted
if ~isvalid(fh); break; end
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Graphics Performance finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!