Error "Invalid or deleted object." when close a GUI in App Designer
Afficher commentaires plus anciens
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)
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Develop Apps Using App Designer dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!