Signal logging
Option to log data for signals marked for logging in model
Model Configuration Pane: Data Import/Export
Description
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
code.
logsout = out.logsout;
Settings
on
(default) | off
on
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
Simulink.SimulationOutput
object.Signal logging always saves data using the
Dataset
format.Data for variable-size signals is saved as a
timetable
that contains a cell array of values for each time step.off
The software does not log signal data during simulation, regardless of whether the signal is marked for logging in the model.
Tips
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 Simscape Data Logging (Simscape).
Recommended Settings
The table summarizes recommended values for this parameter based on considerations related to code generation.
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | No recommendation |
Safety precaution | No recommendation |
Programmatic Use
Parameter: SignalLogging |
Value: 'on' | 'off' |
Default: 'on' |
Parameter: SignalLoggingName |
Type: character vector |
Value: valid MATLAB variable name |
Default: 'logsout' |
Limitations
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.