Error "Invalid or deleted object." when close a GUI in App Designer
Mostrar comentarios más antiguos
Hi, I tried to create an app simply to display capture from a webcam. The main functions are like below.
properties (Access = private)
KeepRunning = 1;
cam = webcam('USB Video Device');
end
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
app.cam.Resolution = '640x480';
while 1
rgbImage = snapshot(app.cam);
imshow(rgbImage,'Parent',app.UIAxes);
drawnow;
end
end
% Close request function: UIFigure
function UIFigureCloseRequest(app, event)
delete(app.cam)
delete(app)
end
end
Everything works fine; however, as I close the GUI (using X button), this error popped up. Any ideas?
Invalid or deleted object.
Error in app_test/startupFcn (line 23)
rgbImage = snapshot(app.cam);
Error in app_test (line 84)
runStartupFcn(app, @startupFcn)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Develop Apps Using App Designer en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!