User`s guide

3 Working with Real-Time Workshop
3-20
To configure data logging, you use the Data Import/Export pane of the
Configuration Parameters dialog. The process is the same as configuring a
Simulink model to save output to the MATLAB workspace. In addition,
however, for each workspace return variable you define and enable,
Real-Time Workshop defines a parallel MAT-file variable. For example, if you
save simulation time to the variable
tout, your generated program logs the
same data to a variable named
rt_tout. You can change the prefix rt_ to a
suffix (
_rt), or eliminate it entirely. You do this from the Interface tab of the
Real-Time Workshop configuration dialog.
Note Simulink enables you to log signal data from anywhere in a model via
the
Log signal data option in the Signal Properties dialog (accessed via
context menu by right-clicking on signal lines). Real-Time Workshop does
not incorporate this method of signal logging in generated code. To log
signals in generated code, you must either use the
Data Import/Export
options described below or include To File or To Workspace blocks in your
model.
In this tutorial, you modify the
f14rtw model such that the generated
program saves the simulation time and system outputs to the file
f14rtw.mat. Then you load the data into the MATLAB workspace and plot
simulation time against one of the outputs.
Part 1: Data Logging During Simulation
To use the data logging feature,
1 With the model f14rtw open, select Configuration Parameters from the
Simulation menu (or type Ctrl+E).
2 Select the Data Import/Export tab of the Configuration Parameters
dialog. Its
Save to workspace section lets you specify which outport data
is to be saved to the workspace and what variable names to use for it.
3 Select the Time option. This tells Simulink to save time step data during
simulation as a variable named
tout. You can enter a different name to
distinguish different simulation runs (for example using different step
sizes), but allow the name to default for this exercise. Selecting
Time