Borrar filtros
Borrar filtros

Pausing Simulink Model programmatically not working

5 visualizaciones (últimos 30 días)
Byron Piper
Byron Piper el 19 de Jul. de 2022
Respondida: Kshittiz el 21 de Sept. de 2023
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?

Respuestas (1)

Kshittiz
Kshittiz el 21 de Sept. de 2023
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

Categorías

Más información sobre Model, Block, and Port Callbacks en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by