Products & Services Solutions Academia Support User Community Company

Learn more about Signal Processing Blockset   

Signal From Workspace - Import signal from MATLAB workspace

Library

Signal Processing Sources

dspsrcs4

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 (M≠1), each of the N columns is treated as a distinct channel. You specify the frame size in the Samples per frame parameter, Mo, and the output is an Mo-by-N matrix containing Mo consecutive samples from each signal channel. You specify the output sample period in 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 (that is, 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:

Examples

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

Signal

The name of the MATLAB workspace variable from which to import the signal, or a valid MATLAB expression specifying the signal.

Sample time

The sample period, Ts, of the output. The output frame period is Mo*Ts.

Samples per frame

The number of samples, Mo, to buffer into each output frame. This value must be 1 when you specify a 3-D array in the Signal parameter.

Form output after final data value by

Specifies the output after all of the specified signal samples have been generated. The block can output zeros for the duration of the simulation (Setting to zero), repeat the final data sample (Holding Final Value) or repeat the entire signal from the beginning (Cyclic Repetition).

Warn when frame size does not evenly divide input length

Select this parameter to be alerted when the input length is not an integer multiple of the frame size and your model will become multirate. For more information, see Initial and Final Conditions.

This parameter is only visible when Cyclic Repetition is selected for the Form output after final data value by parameter.

Supported Data Types

See Also

From Audio DeviceSignal Processing Blockset
From Wave FileSignal Processing Blockset
Signal From WorkspaceSignal Processing Blockset
From WorkspaceSimulink
To WorkspaceSimulink
Triggered Signal From WorkspaceSignal Processing Blockset

See the sections below for related information:

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS