How to properly stop background while loop while closing app designer UI
Mostra commenti meno recenti
Hi all,
I had designed an app designer UI with a background while loop. Currently, I faced difficultyies in break the background while loop when I tried to close the UI. I use a closedRequestFunc and delete(app) operator to close the UI. However, some error just popped up after close as below:
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Invalid or deleted object.
Error in MEMS_comm_int_V4_3_backgroud_timer_running/Background (line 612)
app.outputEditField.Value = fetchOutputs(result);
Error in MEMS_comm_int_V4_3_backgroud_timer_running/SimStartStopButton_callback (line 973)
Background(app);
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 378)
Error while evaluating DestroyedObject PrivateValueChangedFcn.
Error while evaluating TimerFcn for timer 'timer-60'
Invalid or deleted object.
------------------------------------------------------------------------------------------------------------------------------------------------------------------
It seems that even the app is closed the while loop is still working and here is my understanding: In closeRequestFunc, I reseted a flag making while statement to be false but, it looked like that, after closeRequestFunc, the program would return to the stop point before closeRequestFunc and finish its works in the last while loop.
Does anyone face this problem before and know how to solve it?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Code Execution in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!