Reputation: 11
i am working with simulink model where i have to launch my simulation for a specific time period. currently i am using
set_param('model_name','StartTime','0','StopTime','5');
set_param('model_name','SimulationCommand','start');
the problem with this approach is when simulation ends and i start it again, it starts from the beginning and all the simulation progress will lost. here i want to run the simulation from last state.How to do this?
Upvotes: 0
Views: 332
Reputation: 1320
You can save the state of your model to relaunch it again from the last state.
Save the state of your model using this command before starting the simulation
set_param('yourModelName','SaveFinalState','on','FinalStateName','myFinalStateVar','SaveCompleteFinalSimState','on')
and before launching the simulation again set the initial state of the model by using the command
set_param('yourModelName','LoadinitialState','on','InitialState','mySimState')
this way you will launch the simulation from exactly last state you left.
Upvotes: 5