Is there a command line way to step forward and backward in my Simulink model in the same way that the Simulation stepper allows me to do in the toolstrip.
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 9 Sep. 2016
Bearbeitet: MathWorks Support Team
am 23 Apr. 2021
I understand that I can use the Simulation stepper interface to step forwards and backwards in my Simulink model. Is there a command line alternative to do this ?
Akzeptierte Antwort
MathWorks Support Team
am 23 Apr. 2021
Bearbeitet: MathWorks Support Team
am 23 Apr. 2021
There is no direct method of doing this. However, there are a few workarounds.
1. This method works only from MATLAB R2013b and future releases.
Use the command line to execute the following lines :
>> set_param(OBJECT, 'SimulationCommand', 'start', 'SimulationCommand', 'pause'); %Takes the simulation to time t = 0.0 and pauses it
>> set_param(OBJECT, 'SimulationCommand', 'continue', 'SimulationCommand', 'pause'); %Runs the simulation for 1 time step and pauses it
where OBJECT is the model or block object on which to apply the simulation.
2. A more consistent method for stepping forward in fixed time-steps would be to use the "step top" command in the Simulink Debugger mode.
Use the command line to execute the following:
>>sldebug('MODEL_NAME') %Start the simulation in debug mode for the model named MODEL_NAME. Takes simulation to t=0.0 and pauses it
(sldebug@0:) >> step top %Finishes all the initialization parts of the simulation
(sldebug@0:) >> step top %Runs the simulation for 1 time step and pauses it
There does not seem to be a method for stepping backwards in time.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Debug Simulations Programmatically finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!