Timer deletion Problem while closing an app in app designer
9 ビュー (過去 30 日間)
古いコメントを表示
Venkata Sai Sampath Pavan Kumar Rachumallu
2019 年 10 月 16 日
回答済み: Harshavardhan
2025 年 2 月 6 日 6:27
Hello all
I have created an app with a button using app designer, which on button click will create a timer. This timer will invoke a function after specified delay.However when i close the app ,MATLAB is automatically deleting the running timer object.How can i run the timer even after closing the app?
Kindly help.Thanks in advance
function buttonclick_callback()
delay_seconds=10000;
tmr = timer('Name','delay_timer','TimerFcn',@(~,~)upload_status,'StartDelay',delay_seconds);
start(tmr)
end
0 件のコメント
回答 (1 件)
Harshavardhan
2025 年 2 月 6 日 6:27
I see that you are trying to create a timer, when a button is pressed in an app using app designer, which continues to run even after the app is closed.
To make the timer object persist you can use the function “assignin” to shift the timer object from the function’s workspace to the base workspace.
assignin('base','persistent_timer',tmr);
For the version specific documentation of “assignin” you can type the following line in a MATLAB command window.
doc assignin
Hope this helps.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!