Using Simulink | ![]() ![]() |
Interacting with the Simulink Accelerator Programmatically
Using three commands, set_param
, sim
, and accelbuild
, you can control the execution of your model from the MATLAB prompt or from M-files. This section describes the syntax for these commands and the options available.
Controlling the Simulation Mode
You can control the simulation mode from the MATLAB prompt using
You can use gcs
("get current system") to set parameters for the currently active model (i.e., the active model window) and modelname
if you want to specify the model name explicitly. The simulation mode can be either normal
or accelerator
.
Simulating an Accelerated Model
You can also simulate an accelerated model using
Again, you can substitute the modelname
for gcs
if you prefer to specify the model explicitly.
Building Simulink Accelerator MEX-Files Independent of Simulation
You can build the Simulink Accelerator MEX-file without actually simulating the model by using the accelbuild
command, for example,
Creating the Accelerator MEX-files in batch mode using accelbuild
allows you to build the C code and executables prior to running your simulations. When you use the Accelerator interactively at a later time, it does not need to generate or compile MEX-files at the start of the accelerated simulations.
You can use the accelbuild
command to specify build options such as turning on debugging symbols in the generated MEX-file.
![]() | Using the Simulink Accelerator with the Simulink Debugger | Comparing Performance | ![]() |