Is it possible to change a workspace value during simulation?

4 次查看(过去 30 天)
I have a variable defined as scope parameter inside stateflow and i defined the value of that parameter in workspace. While running, shall i able to pause the simulation and change the value in workspace?

采纳的回答

Kaustubha Govind
Kaustubha Govind 2013-4-19
Yes, that should be possible as long the the parameter is marked as tunable (which it is by default, I think). You will need to run Ctrl+D on the model or set_param('modelname', 'SimulationCommand', 'update') after changing the workspace value to ensure that Simulink notices the new value.
  1 个评论
Jaydip Davara
Jaydip Davara 2019-6-11
set_param('modelname', 'SimulationCommand', 'update') is not working for me. Do you any other suggestions/idea that could help me do this task?

请先登录,再进行评论。

更多回答(2 个)

Sysenso Systems
Sysenso Systems 2013-4-20
If you want to make the change without updating the model, you may need to set "add_exec_event_listener" to the block which has the tunable parameter and you can change the value through a callback. Please read >> help add_exec_event_listener.

Moussaoui Aghiles
Moussaoui Aghiles 2020-12-28
HiI have a problem I can not get the desired value with 'to workspace', or instead of having 3 value I find 51 mrc

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by