Main Content

Logging Intervals

This example shows how to specify logging intervals. Simulink limits the data logging to the specified intervals.

Open the Example Model

Open the example model.

Description of the Example

In this example, you can reduce the amount of logged data by limiting data logging to specific simulation-time intervals. The Increment block in this example has two signals: Increment and Reset. Double-click the Increment block to see the signals. In this example, you will specify two intervals to log the data of two system events triggered by the Increment and Reset signals. The first interval captures the first reset event. The second interval captures the behavior of the system after the increment event takes place and the signals reach the lower saturation limits. The intervals are based on the Increment and Reset signal values.

Set up the Logging Intervals and Simulate the Model

You can specify the Logging Intervals parameter value in ''Configuration Parameters > Data Import/Export > Logging intervals'' settings. To enable the Logging Intervals parameter, turn on ''Single simulation output''. Click here to open the Configuration Parameters Dialog.

The Logging Intervals parameter value must be a real double matrix with two columns. The matrix elements cannot be NaN. Each row defines the start and end times for an interval. Intervals must be disjoint and ordered.

Set Logging Intervals to [9,10.5;14.5,30] and simulate the model.

OUTERDATA is a wide signal with two elements. The scope shows the values of the OUTERDATA signal during simulation. The scope does not honor the Logging Intervals specification. The Logging Intervals specification is honored when logging time, root outports, signals, Datastore memory, states, and other kinds of data. The Figure shows the logged values of the OUTERDATA captured as part of signal logging:

    >> out.get('topOut').get('OUTERDATA')

The MATLAB stem function is being used to display the logged data - ignoring the interpolation settings of the data.


Close the model.