How to properly stop background while loop while closing app designer UI
显示 更早的评论
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?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Code Execution 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!