Run Application fromMATLABCommand 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 modelsldrtex_model
. To open this model, in the MATLAB Command Window, type:
open_system(docpath(fullfile(docroot,'toolbox',...'sldrt','examples','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')
预计到达rt 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')
预计到达rt 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')
模型sldrtex_model加载
预计到达rt running the real-time application, type:
set_param(gcs,'SimulationCommand','start')
To stop the real-time application, type:
set_param(gcs,'SimulationCommand','stop')