Reset Simulink model from m file

조회 수: 8 (최근 30일)
Lucas
Lucas 2012년 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!

채택된 답변

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에서 Event Functions에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by