DSP Blockset | ![]() ![]() |
Import a signal from the MATLAB workspace.
Library
Description
The Signal From Workspace block imports a signal from the MATLAB workspace into the Simulink model. The Signal parameter specifies the name of a MATLAB workspace variable containing the signal to import, or any valid MATLAB expression defining a matrix or 3-D array.
When the Signal parameter specifies an M-by-N matrix (M1), each of the N columns is treated as a distinct channel. The frame size is specified by the Samples per frame parameter, Mo, and the output is an Mo-by-N matrix containing Mo consecutive samples from each signal channel. The output sample period is specified by the Sample time parameter, Ts, and the output frame period is Mo*Ts. For Mo=1, the output is sample-based; otherwise the output is frame-based. For convenience, an imported row vector (M=1) is treated as a single channel, so the output dimension is Mo-by-1.
When the Signal parameter specifies an M-by-N-by-P array, each of the P pages (an M-by-N matrix) is output in sequence with period Ts. The Samples per frame parameter must be set to 1
, and the output is always sample-based.
Initial and Final Conditions
Unlike the Simulink From Workspace block, the Signal From Workspace block holds the output value constant between successive output frames (i.e., no linear interpolation takes place). Additionally, the initial signal values are always produced immediately at t=0.
When the block has output all of the available signal samples, it can start again at the beginning of the signal, or simply repeat the final value or generate zeros until the end of the simulation. (The block does not extrapolate the imported signal beyond the last sample.) The Form output after final data value by parameter controls this behavior:
Example 1
In the first model below, the Signal From Workspace imports a two-channel signal from the workspace matrix A
. The Sample time is set to 1
and the Samples per frame is set to 4
, so the output is frame-based with a frame size of 4 and a frame period of 4 seconds. The Form output after final data value by parameter specifies Setting To Zero, so all outputs after the third frame (at t=8) are zero.
Example 2
In the second model below, the Signal From Workspace block imports a sample-based matrix signal from the 3-D workspace array A
. Again, the Form output after final data value by parameter specifies Setting To Zero, so all outputs after the third (at t=2) are zero.
The Samples per frame parameter is set to 1
for 3-D input.
Dialog Box
1
if a 3-D array is specified in the Signal parameter.Supported Data Types
To learn how to convert to the above data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.
See Also
From Wave Device |
DSP Blockset |
From Wave File |
DSP Blockset |
Signal From Workspace |
DSP Blockset |
To Workspace |
Simulink |
Triggered Signal From Workspace |
DSP Blockset |
See the sections below for related information:
![]() | Short-Time FFT | Signal To Workspace | ![]() |