Documentation Center

  • Trial Software
  • Product Updates

dsp.SignalSource System object

Package: dsp

Import variable from workspace


The SignalSource object imports a variable from the MATLAB® workspace.

To import a variable from the MATLAB workspace:

  1. Define and set up your signal source. See Construction.

  2. Call step to import the variable according to the properties of dsp.SignalSource. The behavior of step is specific to each object in the toolbox.


H = dsp.SignalSource returns a signal source System object™, H, that outputs the variable one sample or frame at a time.

H = dsp.SignalSource('PropertyName',PropertyValue,...) returns a signal source object, H, with each specified property set to the specified value.

H = dsp.SignalSource(signal,spf,'PropertyName',PropertyValue,...) returns a signal source object, H, with the Signal property set to signal, the SamplesPerFrame property set to spf, and other specified properties set to the specified values.



Variable or expression containing the signal

Specify the name of the workspace variable from which to import the signal, or a valid expression specifying the signal. The default is [1:10].


Number of samples per output frame

Specify the number of samples to buffer into each output frame. This property must be 1 when you specify a 3-D array in the Signal property. The default is 1.


Action after final signal values are generated

Specify the output after all of the specified signal samples have been generated as one of Set to zero, Hold final value, or Cyclic repetition. The default is Set to zero.


cloneCreate signal reader object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs of step method
isDoneEnd-of-file status for signal reader object
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset internal states of signal reader object
stepRead one sample or frame of signal


Create a signal source to output one sample at a time:

 hsr1 = dsp.SignalSource;
 hsr1.Signal = randn(1024, 1);
 y1 = zeros(1024,1);
 idx = 1;
   y1(idx) = step(hsr1);  
   idx = idx+1;

Create a signal source to output vectors:

 hsr2 = dsp.SignalSource(randn(1024, 1), 128);
 y2 = step(hsr2); % y2 is a 128-by-1 frame of samples


This object implements the algorithm, inputs, and outputs described on the Signal From Workspace block reference page. The object properties correspond to the block parameters, except:

The object does not have properties that correspond to the Sample time or Warn when frame size does not evenly divide input length block parameters.

See Also

Was this topic helpful?