Reset Simulink model from m file
5 次查看(过去 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!
0 个评论
采纳的回答
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
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 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!