Error while evaluating DestroyedObject Callback.

14 visualizaciones (últimos 30 días)
Cesar Ramirez
Cesar Ramirez el 3 de Mzo. de 2019
Comentada: Cesar Ramirez el 4 de Mzo. de 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.

Respuesta aceptada

Walter Roberson
Walter Roberson el 4 de Mzo. de 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 comentario
Cesar Ramirez
Cesar Ramirez el 4 de Mzo. de 2019
OMG!!, It works, Thank you very much. You really help me.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Performance en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by