Problem with Matlab gui quitting
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Ajay Kumar
el 3 de Oct. de 2019
Try this:
write countdown(app) instead of app.countdown in startupFcn.
0 comentarios
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!