Using Simulink | ![]() ![]() |
Using the sim Command
The full syntax of the command that runs the simulation is
Only the model
parameter is required. Parameters not supplied on the command are taken from the Simulation Parameters dialog box settings.
For detailed syntax for the sim
command, see the documentation for the sim
command. The options
parameter is a structure that supplies additional simulation parameters, including the solver name and error tolerances. You define parameters in the options
structure using the simset
command (see simset
). The simulation parameters are discussed in The Simulation Parameters Dialog Box.
Using the set_param Command
You can use the set_param
command to start, stop, pause, or continue a simulation, or update a block diagram. The format of the set_param
command for this use is
where 'sys'
is the name of the system and 'cmd'
is 'start'
, 'stop'
, 'pause'
, 'continue'
, or 'update'
.
Similarly, you can use the get_param
command to check the status of a simulation. The format of the get_param
command for this use is
Simulink returns 'stopped'
, 'initializing'
, 'running'
, 'paused'
, 'updating'
, 'terminating'
, and 'external'
(used with Real-Time Workshop).
![]() | Running a Simulation Programmatically | Analyzing Simulation Results | ![]() |