フィルターのクリア

Pausing Simulink Model programmatically not working

5 ビュー (過去 30 日間)
Byron Piper
Byron Piper 2022 年 7 月 19 日
回答済み: Kshittiz 2023 年 9 月 21 日
I'm trying to pause my simulation using this line of code:
set_param(app.model,'SimulationCommand','pause')
However for some reason the simulation just continutes to run, effectively ignoring this. I know this line of code is definitely called but it doesn't work.
I'd like to have a system where I can pause and continute the simulation whenever I want as the stop time is 'Inf' with certain conditions to stop it if needed.
Any reason why I cannot pause the simulation?

回答 (1 件)

Kshittiz
Kshittiz 2023 年 9 月 21 日
Hi Byron,
I understand you’re using the “set_param” function to pause your simulation but it’s not working as per your expectation.
Since I do not have your entire script, it is difficult to determine the exact reason why the "set_param" function is not functioning as expected. However, as a possible workaround for this issue, you can incorporate the "pause" command within your simulation loop or callback.
The “pause” command temporarily stops MATLAB execution and waits for the user to press any key. Note that although it temporarily stops the execution of Simulink models, it does not pause their repainting. To learn how to use it, refer the following documentation:
I hope this solves your query.
Thanks and Regards,
Kshittiz

カテゴリ

Help Center および File ExchangeModel, Block, and Port Callbacks についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by