You can view the signal logging data for a paused or completed simulation, using one of these interfaces:
The Simulation Data Inspector
Programmatically, using MATLAB® commands
To access signal logging data programmatically, the approach
you use depends on the signal logging data format (
For details, see:
Note: If you do not see logging data for a signal that you marked in the model for signal logging, check the logging configuration using the Signal Logging Selector. Use the Signal Logging Selector to enable logging for a signal whose logging is overridden. For details, see View the Signal Logging Configuration and Override Signal Logging Settings.
Simulink® saves signal logging data in a signal logging object, which you access using a MATLAB workspace variable.
The type of the signal logging object depends on the signal logging format that you choose. For details, see Specify the Signal Logging Data Format.
Dataset format —
ModelDataLogs format —
The default name of the signal logging variable is
You can change the variable name. For details, see Specify a Name for the Signal Logging Data for a Model.
You can use the Simulation Data Inspector to view logged signal data.
To view logged signal data with the Simulation Data Inspector, open the Simulink Editor and use one of the following approaches:
To display logged signals when a simulation ends or when you pause a simulation, select Simulation > Output > Send Logged Workspace Data to Data Inspector.
To launch the Simulation Data Inspector to display the logged data, select Simulation > Output > Simulation Data Inspector.
For additional information about using the Simulation Data Inspector, see Inspect Signal Data with Simulation Data Inspector.
Signal names in data logs can have spaces or newlines in their names when:
The signal is named and the name includes a space or newline character.
The signal is unnamed and originates in a block whose name includes a space or newline character.
The signal exists in a subsystem or referenced model, and the name of the subsystem, Model block, or of any superior block, includes a space or newline character.
The following three examples show a signal whose name contains a space, a signal whose name contains a newline, and an unnamed signal that originates in a block whose name contains a newline:
The following example shows how to handle spaces or new lines in logged names, if a model uses:
Dataset for the signal
The default of
logsout for the
signal logging data
logsout = Simulink.SimulationData.Dataset Package: Simulink.SimulationData Characteristics: Name: 'logsout' Total Elements: 3 Elements: 1: '' 2: 'x y' 3: 'a b'
To access a signal with a space or newline, use the index. For
example, to access the
x y signal:
For information on extracting signal data from that object,