This example shows how to use the Simulink Real-Time template to create a Simulink model. Starting from the model template provides a new model that has configuration parameters set up for building a real-time application.
To see the Simulink Real-Time commands for each operation in this example, view the example code.
To create a Simulink model from the Simulink start page, in the MATLAB Command Window, type:
Select the Simulink Real-Time template from the start page and create the
exampleSlrealtimeApp model. Or, in the Command Window, use the
Simulink.createFromTemplate command. See code for this script for full syntax.
The Simulink Real-Time model template contains a Gain block that connects a Signal Generator to a Scope block. The Gain block output is marked for logging with the Simulation Data Inspector (SDI).
Build the real-time application, run it on the target computer, and view the logged data:
1. Make sure that the development computer has a connection to the target computer.
2. Build the model and download the real-time application to the target computer. On the Real-Time tab, click Run on Target. Or, use the
slbuild command and the
3. Run the real-time application and log data by using the Run on Target button.
4. Open the Simulation Data Inspector by double-clicking the Simulation Data Inspector icon on the Gain block output signal or by using the