| SimEvents® | ![]() |
SimEvents Sinks
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.
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.
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.
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.

The name of the structure or array that holds the data.
The maximum number of input samples to be saved.
A positive integer, n, that specifies the decimation factor. The block ignores the first n-1 out of every n input samples.
Format in which to save simulation output to the workspace. The recommended format for event-based signals is Structure With Time.
Sending Data to the MATLAB® Workspace
![]() | Discrete Event Outport | Discrete Event Subsystem | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |