DSP Blockset | ![]() ![]() |
Exporting a Frame-Based Signal
Using the To Workspace Block
Recall that a frame-based signal with N channels and frame size M is represented by a sequence of M-by-N matrices. (The special case of N = 1 represents a single-channel signal.) When the input to the To Workspace block is a frame-based signal (and the Save format parameter is set to Array), the block creates an P-by-N array in the MATLAB workspace containing the P most recent samples from each channel. The number of rows, P, is specified by the Limit data points to last parameter. The newest samples are added at the bottom of the matrix.
The figure below illustrates this for three consecutive frames of a frame-based signal (two samples per frame) exported to matrix A
.
The workspace matrix always has time running along its first (P) dimension. Samples are saved along the P dimension whether the input is a matrix, vector, or scalar (single channel).
The following example illustrates how the To Workspace block can be used to export a frame-based multichannel signal to the MATLAB workspace.
Example: Exporting a Frame-Based Signal. In the model below, the To Workspace block exports a three-channel frame-based signal with the following data:
To create the model, define the following variables at the MATLAB command line:
Matrix A
represents a two-channel signal with 100 samples, and matrix B
represents a one-channel signal with 100 samples.
Specify the following parameter values in the Signal From Workspace block:
[A B]
1
4
The Sample time setting of 1
and Samples per frame setting of 4
yield a frame-based output with sample period of 1 second and frame period of 4 seconds.
Specify the following parameter values in the To Workspace block:
yout
inf
1
-1
Run the model, and look at output yout
. The first 10 samples (rows) are shown:
These two sections may also be of interest to you:
![]() | Exporting a Sample-Based Signal Using the To Workspace Block | Exporting and Playing WAV Files | ![]() |