Reset Simulink model from m file

3 次查看(过去 30 天)
I need to reset a model within an m-file. I know using : set_param(model, 'SimulationCommand', 'start') set_param(model, 'SimulationCommand', 'stop')
can start ans stop a model within a m-file. But how about reseting - i.e. stopping the model and then re-starting from initial condition, time = 0 ? Thanks!

采纳的回答

Kaustubha Govind
Kaustubha Govind 2012-5-30
Using set_param(model, 'SimulationCommand', 'stop') followed by set_param(model, 'SimulationCommand', 'start') does restart the model from t=0. You need to use set_param(model, 'SimulationCommand', 'pause') followed by set_param(model, 'SimulationCommand', 'start') to continue where the model was paused.
  1 个评论
Kaustubha Govind
Kaustubha Govind 2012-5-31
That doesn't sound right. So just to get this right - when you run set_param(model, 'SimulationCommand', 'start') for the first time, you get a value for 4 cycles, correct? Every consecutive set_param(model, 'SimulationCommand', 'start') should have the exact same behavior as the first time, unless you have something like a Random Number block.

请先登录,再进行评论。

更多回答(0 个)

类别

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

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by