Main Content

Simulink.SimulationData.LoggingInfo

Signal logging override settings

Description

Use a Simulink.SimulationData.LoggingInfo object to specify the LoggingInfo property of a Simulink.SimulationData.SignalLoggingInfo object. You can use this object to set signal logging override settings such as decimation, logging name, and the number of data points.

Creation

Description

logInfoObj = Simulink.SimulationData.LoggingInfo creates a Simulink.SimulationData.LoggingInfo object with default property values.

example

logInfoObj = Simulink.SimulationData.LoggingInfo(logInfo) creates a Simulink.SimulationData.LoggingInfo object that copies the property values from the signal logging override object that you specify with the logInfo argument.

Input Arguments

expand all

Signal logging override setting object whose property values the constructor uses for the new Simulink.SimulationData.LoggingInfo object, specified as a Simulink.SimulationData.LoggingInfo object or Simulink.LoggingInfo object.

Properties

expand all

Signal logging mode, specified as a numeric or logical 1 (true) or 0 (false).

  • true –– Logging is enabled for this signal.

  • false –– Logging is not enabled for this signal.

Source of signal logging name, specified as a numeric or logical 1 (true) or 0 (false).

  • true — Signal logging name is a custom name.

  • false — Signal logging name is the same as the signal name.

Custom signal logging name to use for the signal if the NameMode property is true, specified as a string or character vector.

Option to log a subset of sample points, specified as a numeric or logical 1 (true) or 0 (false).

  • true — Log a subset of sample points selecting data points at a specified interval. The first sample point is always logged.

  • false — Log all sample points.

Decimation value (n), specified as a positive integer. If the DecimateData property is true, then the software logs every nth data point.

Option to limit number of logged data points, specified as a numeric or logical 1 (true) or 0 (false).

  • true — Limit the number of logged data points. The limit is the last number of data points generated by the simulation as specified by the MaxPoints property.

  • false — Log all data points.

Maximum number of data points to log (N), specified as a positive integer. If the LimitDataPoints property is true, then the set of logged data points includes the last N data points generated by the simulation.

Examples

collapse all

You can use a Simulink.SimulationData.LoggingInfo object to create a set of signal logging override settings for a signal. For example, you can change the decimation settings to log a subset of sample points in a signal.

Open the model sldemo_mdlref_bus. By default, the model does not decimate data. For more information about the model, see Interface Specification Using Bus Objects.

mdl = "sldemo_mdlref_bus";
open_system(mdl)

You can override signal logging settings so the software logs only a subset of sample points in the COUNTERBUS signal by specifying a decimation factor in the LoggingInfo property of a signal logging override object. First, create a Simulink.SimulationData.LoggingInfo object with default settings.

logInfo = Simulink.SimulationData.LoggingInfo;

Change the DecimateData and Decimation properties to log every tenth data point, starting with the first sample point.

logInfo.DecimateData = true;
logInfo.Decimation = 10;

Create a Simulink.SimulationData.SignalLoggingInfo object for the COUNTERBUS signal. Then, to log only the subset of data points in the COUNTERBUS signal, set the LoggingInfo property of the signal logging override object to logInfo.

blkPath = "sldemo_mdlref_bus/Concatenate";
sigInfo = Simulink.SimulationData.SignalLoggingInfo(blkPath);
sigInfo.LoggingInfo = logInfo;

Create an empty Simulink.SimulationData.ModelLoggingInfo object. Then, assign the signal logging override settings sigInfo to the model logging information object.

mdlInfo = Simulink.SimulationData.ModelLoggingInfo(mdl);
mdlInfo.Signals = sigInfo;

Apply the model override object settings using the set_param function.

set_param(mdl,'DataLoggingOverride',mdlInfo)

Version History

Introduced in R2012b