Option to log data for signals marked for logging in model
Model Configuration Pane: Data Import/Export
Specify whether to log data for signals marked for logging to the workspace and the Simulation Data Inspector.
By default, simulation results are returned as a single
Simulink.SimulationOutput object. The logging variable you specify for
logged signals becomes a property of the
SimulationOutput object. To
access the logged signal data, use dot notation. For example, when you use the default
output variable name
out and the default signal logging variable name
logsout, access the signal data using this
logsout = out.logsout;
The software logs data for signals marked for logging in the model to the workspace and the Simulation Data Inspector. By default, the logged signal data is saved in the variable
logsout. To save the data using a different variable name, specify a valid MATLAB® variable name in the text box.
The variable must not have a name that matches the name of any object functions or properties of the
Signal logging always saves data using the
Data for variable-size signals is saved as a
timetablethat contains a cell array of values for each time step.
The software does not log signal data during simulation, regardless of whether the signal is marked for logging in the model.
If you select Signal logging, you can use the Configure Signals to Log button to open the Signal Logging Selector. You can use the Signal Logging Selector to:
Review all signals in a model hierarchy that are configured for logging.
Override signal logging settings for specific signals.
Control signal logging throughout a model reference hierarchy.
You can use the Signal Logging Selector for both Simulink® and Stateflow® signals.
For details about the Signal Logging Selector, see View Logging Configuration Using the Signal Logging Selector and Override Signal Logging Settings.
For information about logging Simscape™ data, see About Simulation Data Logging (Simscape).
The table summarizes recommended values for this parameter based on considerations related to code generation.
|Safety precaution||No recommendation|
|Type: character vector|
|Value: valid MATLAB variable name|
Signal logging is not supported for:
Signals inside Stateflow charts for rapid accelerator simulations
Input signals of function-call subsystems, if-action subsystems, or switch case action subsystems
Input signals for Merge blocks
Outputs of Function-Call Generator blocks
Outputs of Trigger and Enable blocks
Buses inside for-each subsystems
Signals in referenced models inside for-each subsystems when:
The model that contains the for-each subsystem simulates in rapid accelerator mode.
The for-each subsystem is inside a referenced model simulated in accelerator mode.
For more information about logging signals in for-each subsystems, see Log Signals in For-Each Subsystems
State port outputs of Integrator and Discrete-Time Integrator blocks.
Version HistoryIntroduced before R2006a
R2023b: Log unbounded variable-size signals
In normal and accelerator mode simulations, you can log an unbounded variable-size signal using signal logging. Logging is not supported for nonvirtual buses that contain unbounded variable-size signals.
R2023a: Log nonvirtual buses that contain variable-size signals
In normal and accelerator mode simulations, you can log:
Nonvirtual buses that contain variable-size signals directly or in nested buses
Buses with nested nonvirtual buses that contain variable-size signals
In normal mode simulations only, you can log:
Arrays of buses with nonvirtual buses that contain variable-size signals
R2021a: Variable-size signal support
You can mark variable-size signals for logging when you use the
Data for variable-size signals is saved as a
contains a cell array of values for each time step.
R2019a: Signal logging parameter controls whether data streams to Simulation Data Inspector
Since R2017a, signals you mark for logging also stream to the Simulation Data Inspector. Between R2017a and R2019a, the data always streamed to the Simulation Data Inspector, even when you disabled the Signal logging parameter. Starting in R2019a, data for signals you mark for logging streams to the Simulation Data Inspector only when you enable the Signal logging parameter.
R2017a: Unified streaming and logging
When you mark a signal for logging, the data for that signal streams to the Simulation Data Inspector during simulation in addition to being logged to the workspace. In previous releases, you marked signals for logging and streaming separately. Streaming badges are converted to logging badges.
Data for signals that are marked for logging always streams to the Simulation Data Inspector, even when you disable the Signal logging parameter for the model. When you disable the Signal logging parameter, the data does not log to the workspace.