Discrete Event Signal to Workspace - Write event-based signal to workspace

Library

SimEvents Sinks

Description

This block writes its input to a structure or array in the base MATLAB® workspace when the simulation stops or pauses. This block is similar to the To Workspace block in the Simulink® Sinks library but is tailored for use with event-based signals.

Output Format

The Save format parameter determines the output format. The Structure With Time output format is most appropriate for event-based signals because it indicates when the signal assumes each value. Updates of event-based signals are typically aperiodic.

For scalar signals, you can convert a structure with time into a two-column matrix containing times in the first column and signal values in the second column. To do this, use an assignment like the one below. In place of simout, use the name specified in this block's Variable name parameter.

times_values = [simout.time, simout.signals.values];

For descriptions of all output formats, see the reference page for the To Workspace block.

Comparison with To Workspace Block

This block can detect zero-duration values of the input signal, as well as signal updates that do not necessarily correspond to time steps determined by time-based dynamics.

This block does not support data types other than double, and has no Sample time parameter because event-based signals do not have a true sample time.

The simulation times at which this block records data is typically unrelated to the variable that a model creates if you select Time in the Save to workspace section of the Data Import/Export tab of the Configuration Parameters dialog box. By default, this option is selected and the variable is called tout. The simeventsconfig function clears the time logging option to avoid confusion between the time steps listed in tout and the update times of event-based signals in the simulation.

Ports

This block has one signal input port for the signal to write to the workspace.

The block has no entity ports, and no signal output port.

Dialog Box

Variable name

The name of the structure or array that holds the data.

Limit data points to last

The maximum number of input samples to be saved.

Decimation

A positive integer, n, that specifies the decimation factor. The block ignores the first n-1 out of every n input samples.

Save format

Format in which to save simulation output to the workspace. The recommended format for event-based signals is Structure With Time.

Examples

See Also

To Workspace

Sending Data to the MATLAB® Workspace

  


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