Skip to Main Content Skip to Search
Product Documentation

Using the set_param Command

You can use the set_param command to start, stop, pause, or continue a simulation, to update a block diagram, or to write all data logging variables to the base workspace. The format of the set_param command is:

set_param('sys', 'SimulationCommand', 'cmd')

where 'sys' is the name of the system and 'cmd' is 'start', 'stop', 'pause', 'continue', 'update', or 'WriteDataLogs'. See Importing and Exporting Simulation Data for information about data logging.

Similarly, you can use the get_param command to check the status of a simulation. The format of the get_param function call for this use is

get_param('sys', 'SimulationStatus')

The Simulink software returns 'stopped', 'initializing', 'running', 'paused', 'updating', 'terminating', or 'external' (used with the Simulink Coder product).

Running a Simulation from an S-Function

S-functions can use the set_param command to control simulation execution. A C MEX S-function can use the mexCallMATLAB macro to call the set_param command itself.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS