Main Content

Specify Signal Values to Log

In some situations, you may not need to log signal values for every time step in a simulation. You can use several strategies to specify which signal data to log during simulation. Depending on your requirements, you can use more than one strategy for limiting the size of logged data. You can specify signal values to log using:

  • Decimation — Log every nth signal value.

  • Limit data points to last — Only log the last n signal values.

  • Logging intervals — Specify specific time intervals in which to log data.

Carefully consider data requirements before you reduce the number of signal values logged in a simulation. Limiting data can skip critical time points, and decimation can cause aliasing if the effective sample rate is too low.

Decimation

Decimation reduces the effective sample rate for logged data. To reduce the number of data points logged, specify a decimation factor greater than one. For example, a decimation of factor of 2 logs every other data point, reducing the number of logged points and effective sample rate by half. How you apply the decimation factor depends on the logged data you want to decimate.

Logging MethodHow to Specify Decimation
Signal logging

Use the Signal Properties dialog box or the Instrumentation Properties dialog box. Select Decimation and specify the decimation factor.

To access the Signal Properties dialog, right-click a signal and select Properties.

To access the Instrumentation Properties dialog, right-click the logging badge for a signal and select Properties.

The decimation factor applies only to the selected signal. You can specify different decimation factors for different signals.

Output, time, and states logging

Use the Decimation parameter in the model configuration parameters on the Data Import/Export pane, under Additional parameters.

The specified decimation factor applies for all logged time data, outputs, and states.

Data store logging

To Workspace block

To File block

Use the Decimation block parameter.

The decimation factor applies only to that block.

Log Last n Signal Values

When you only want to save or analyze the data from the end of a simulation, you can configure logging to capture only the last n signal values. How you specify the number of data points to log depends on how the data is logged.

Logging MethodHow to Limit Logging to Last n Points
Signal logging

Use the Signal Properties dialog box or the Instrumentation Properties dialog box. Select Limit data points to last and specify the number of sample values to log.

To access the Signal Properties dialog box, right-click a signal and select Properties.

To access the Instrumentation Properties dialog box, right-click the logging badge for a signal and select Properties.

The setting applies only to the selected signal.

Output, time, and states logging

Select the Limit data points to last parameter in the model configuration parameters on the Data Import/Export pane, under Additional parameters and specify the number of signal values to log.

The setting applies for all logged time data, outputs, and states.

Data store logging

To Workspace block

Use the Limit data points to last block parameter.

The setting applies only to that block.

When you only log the last simulation values, dashboard blocks and the Simulation Data Inspector do not display data during simulation.

Specify Logging Intervals

When you only want to save and analyze data for particular time intervals, you can specify the time intervals in which to log data. Using logging intervals allows you to save specific data without changing or adding complexity to your model.

Specify logging intervals using the Logging intervals parameter on the model configuration parameters Data Import/Export pane, under Additional parameters. Specify the logging intervals as an n-by-2 matrix where n is the number of intervals, the number in the first column indicates the start of the logging interval, and the number in the second column indicates the end. For example, when the Logging intervals setting is specified as [2,4;7,9], logged data is saved between times 2 and 4 and again between times 7 and 9.

The specified logging intervals apply to:

  • Time, states, and output logging.

  • Signal logging.

  • Data logged using the To Workspace block.

  • Data logged using the To File block.

  • Data logged to the workspace using the Record block.

Logging intervals do not apply to final state logging, data logged using scopes, or data logged to the Simulation Data Inspector.

When you use logging intervals, dashboard blocks only update the displayed value of a connected signal during the specified logging intervals.

See Also

Model Settings

Blocks

Tools

Related Topics