You can use Simulink® external mode to establish a communication channel between your Simulink block diagram and your real-time application. The block diagram becomes a user interface to your real-time application. Simulink scopes can display signal data from the real-time application, including from models referenced inside a top model. You can control which signals to upload through the External Signal & Triggering dialog box (see Select Signals to Upload (Simulink Coder) and Control External Mode Simulation Through External Mode Control Panel (Simulink Coder)).
Do not use Simulink external mode while Simulink Real-Time™ Explorer is running. Use only one interface or the other.
This procedure uses the model
xpcosc contains a
Simulink Scope block.
Open the external mode control panel. In the Simulink Editor, on the Real-Time tab, click Prepare > Control Panel.
In the external mode control panel, click the Signal & Triggering button.
In the External Signal & Triggering dialog box,
set the Source parameter to
Set the Mode parameter to
In this mode, the scope acquires data continuously.
Select the Arm when connecting to target check box.
In the Delay box, enter
In the Duration box, enter the
number of samples for which external mode is to log data, for example
The External Signal & Triggering dialog box looks like this figure.
Click Apply, and then Close.
In the External Mode Control Panel dialog box, click OK.
In the Simulink toolbar, increase the simulation
stop time to, for example,
Save the model as
ex_slrt_ext_osc. On the
Simulation tab, from Save, click
If a scope window is not displayed for the Scope block, double-click the Scope block.
Connect to the target computer. On the Real-Time tab, toggle the Disconnected indicator to Connected.
Build and download the real-time application to the target computer. On the Real-Time tab, click Run on Target.
The real-time application begins running on the target computer. The Scope window displays plotted data.
To stop the simulation, on the Real-Time tab click Stop.