Run Application from MATLAB Command Line
You can use the MATLAB® command-line interface as an alternative to using the Simulink® UI. Enter commands directly in the MATLAB Command Window or save them in a script file.
After you build the real-time application, you can run your model in real time.
This procedure uses the model sldrtex_model
. To open this model,
in the MATLAB Command Window, type:
openExample('sldrtex_model')
It assumes that you have already created a real-time application from that model.
Connected IO Mode (Normal Mode)
In the MATLAB Command Window, type:
set_param(gcs,'SimulationMode','normal')
To start running the simulation, type:
set_param(gcs,'SimulationCommand','start')
To stop running the simulation, type:
set_param(gcs,'SimulationCommand','stop')
Accelerator Mode
In the MATLAB Command Window, type:
set_param(gcs,'SimulationMode','accelerator')
To start running the simulation, type:
set_param(gcs,'SimulationCommand','start')
To stop running the simulation, type:
set_param(gcs,'SimulationCommand','stop')
Run in Kernel Mode (External Mode)
In the MATLAB Command Window, type:
set_param(gcs,'SimulationMode','external')
To load the real-time application and connect it to the Simulink block diagram, type:
set_param(gcs,'SimulationCommand','connect')
Model sldrtex_model loaded
To start running the real-time application, type:
set_param(gcs,'SimulationCommand','start')
To stop the real-time application, type:
set_param(gcs,'SimulationCommand','stop')