Simulink® normal and accelerator modes run the simulation algorithm in Simulink and access the external hardware by using drivers running in operating system kernel mode. The Simulink block diagram is a user interface to your real-time application.
Simulink external mode connects your Simulink model to your real-time application. You can use the Simulink block diagram as a user interface as you can in normal or accelerator mode.
This procedure uses the model
(matlab: open_system(docpath(fullfile(docroot, 'toolbox', 'sldrt', 'examples', 'sldrtex_model')))).
It assumes that you have already loaded that model.
After you have created a real-time application, you can enter scope parameters for signal tracing with Simulink external mode:
In the Simulation window, from the Simulation menu, click Model Configuration Parameters.
Select the Code Generation > Simulink Desktop Real-Time node.
If you select the External mode check box, your changes affect the real-time application.
Check that the MEX-file name label has
an entry of
sldrtext. The MEX-file
supplied with the Simulink
Desktop Real-Time™ software. This file works
with Simulink external mode and supports uploading signal data
and downloading parameter values.
In the Simulation window, click Code > External Mode Control Panel.
Click the Signal & Triggering button.
Select the Select
all check box.
From the Source list, select
manual. From the Mode list,
X under Signal selection indicates
that a signal is tagged for data collection.
that the signal is tagged as a trigger signal.
In the Duration field, enter the number of sample points in a data buffer. For example, to specify a sample rate of 1000 samples/second and a stop time of 10 seconds, enter:
Select the Arm when connecting to target check box.
If you do not select this check box, data is not displayed in the Scope window.