DSP Blockset    

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:

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 to downsample a signal before exporting to the workspace, consider using the Downsample or FIR Decimation blocks. See Converting Sample Rates and Frame Rates for more information about rate conversion.

The Save format parameter allows you to save the output in a variety of formats. The default is Array, which is also generally the most accessible output format. Although this format does not save a record of the sample times corresponding to the output samples, you can create such a record for a given model by selecting the Time option in the Workspace I/O panel of the Simulation Parameters dialog box. See Performance-Related Settings in dspstartup.m for more information.

The following sections explain how the To Workspace block generates its output:

The following two sections may also be of interest:


  Exporting Signals Exporting a Sample-Based Signal Using the To Workspace Block