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
sldrtex_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 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 Simulink Editor, on the Desktop Real-Time tab, click Prepare > Hardware Settings.
In the Configuration Parameters dialog box, 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
sldrtext.mex* is supplied with the Simulink
Desktop Real-Time™ software. This file works with Simulink external mode and supports uploading signal data and downloading
In the Simulink Editor, on the Desktop Real-Time tab, click Prepare > Control Panel. In the 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.
T indicates 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.