Problem with Matlab gui quitting
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
So i want to create a gui which is basically a timer which counts down from 30 minutes.
Which is something like above. Whenever i click the "Run" button to execute the GUI, the timer will display and countdown.
The code i used is:
function countdown(app)
while true
minute = 29;
set(app.ParallelPoolidletimerTextArea, 'Value', num2str(minute));
seconds = 0;
set(app.TextArea, 'Value', num2str(seconds));
while minute > 0
seconds = 59;
while seconds > 0
set(app.TextArea, 'Value', num2str(seconds));
pause(1);
seconds = seconds - 1;
end
minute = minute - 1;
set(app.ParallelPoolidletimerTextArea, 'Value', num2str(minute));
end
end
end
Since the GUI has a startup function, i just did:
function startupFcn(app)
app.countdown;
end
Hence the countdown works, but the problem is when i quit the application, Matlab throws me an error saying:
Invalid or deleted object.
Error in app.countdown.
Error in runStartupFcn(app, @startupFcn)
Why is this happening?
0 commentaires
Réponses (1)
Ajay Kumar
le 3 Oct 2019
Try this:
write countdown(app) instead of app.countdown in startupFcn.
0 commentaires
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!