Error while evaluating DestroyedObject Callback.

14 次查看(过去 30 天)
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.

采纳的回答

Walter Roberson
Walter Roberson 2019-3-4
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Performance 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by