Main Content

dsp.SignalSink

Log simulation data in buffer

Description

The dsp.SignalSink System object™ logs MATLAB® simulation data. This object accepts any numeric data type.

To log MATLAB simulation data :

  1. Create the dsp.SignalSink object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

ss = dsp.SignalSink returns a signal sink, ss, that logs 2-D input data in the object.

example

ss = dsp.SignalSink(Name,Value) returns a signal sink, ss, with each specified property set to the specified value. Enclose each property name in single quotes. Unspecified properties have default values.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Specify the maximum number of frames to log. The object always preserves the most recent data in the buffer. When you specify a buffer length that is greater than the input length, the object pads the end of the logged data with zeros. To capture all input data without extra padding, set the BufferLength property to inf.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi

Setting this property to any positive integer d causes the signal sink to write data at every dth sample.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Set the dimension of the output array for frame-based inputs as 2-D array (concatenate) or 3-D array (separate). Concatenation occurs along the first dimension for 2-D array (concatenate).

This property is read-only.

The signal sink writes simulation data into a buffer. Specify the maximum length of the buffer with the BufferLength property.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi

Usage

Syntax

Description

ss(x) buffers the signal x. The buffer may be accessed at any time from the Buffer property of ss.

example

Input Arguments

expand all

Data input, specified as a vector or a matrix.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | fi

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

hlog = dsp.SignalSink;
 for i=1:10
     y = sin(i);
     hlog(y);
 end
log = hlog.Buffer; 
display(log)
log = 10×1

    0.8415
    0.9093
    0.1411
   -0.7568
   -0.9589
   -0.2794
    0.6570
    0.9894
    0.4121
   -0.5440

Algorithms

This object implements the algorithm, inputs, and outputs described on the To Workspace (Simulink) block reference page. The object properties correspond to the block properties, except the object always generates fixed-point output for fixed-point input.

Version History

Introduced in R2012b

See Also

Objects