User`s guide
3 Working with Signals
3-72
Exporting Signals
The To Workspace and Triggered To Workspace blocks are the primary
conduits for exporting signals from a Simulink model to the MATLAB
workspace. The following sections explain how to use these important blocks:
•“Exporting Multichannel Signals” on page 3-72
•“Exporting and Playing WAV Files” on page 3-79
Exporting Multichannel Signals
The To Workspace block in the Simulink Sources library is the key block for
exporting signals of all dimensions to the MATLAB workspace.
The dialog box has the following parameters:
•
Variable name
•Limit data points to last
•Decimation
•Sample time
•Save format
Use the Variable name parameter to specify the workspace variable in which
the output should be saved. (An existing output with the same name is
overwritten.)
The
Limit data points to last parameter specifies how many of the most recent
output samples should be retained in the specified workspace variable. For
example, if you specify
Limit data points to last = 100, then even if the
simulation propagates thousands of samples to the To Workspace block, only
the most recent 100 samples will actually be saved in the workspace. By setting
a limit on the number of saved samples, you can prevent out-of-memory errors
for long-running simulations. Note, however, that the default setting for
Limit
data points to last
is inf, which allows the workspace variable to grow
indefinitely large.
The default values of
1 and -1 for the Decimation and Sample time
parameters (respectively) are generally adequate for DSP models. If you want