Pausing Simulink Model programmatically not working

조회 수: 3 (최근 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 CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by