Error while evaluating DestroyedObject Callback.

14 Ansichten (letzte 30 Tage)
Cesar Ramirez
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.

Akzeptierte Antwort

Walter Roberson
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
  1 Kommentar
Cesar Ramirez
Cesar Ramirez am 4 Mär. 2019
OMG!!, It works, Thank you very much. You really help me.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by