Save Run-Time Data from Simulation

Save simulation data to MATLAB® workspace; log signals; export signal, time, output, and state data

You can save signal values to the MATLAB workspace or to a MAT-file during simulation for later retrieval and postprocessing. Saving simulation data is also known as logging or exporting simulation data.

Saving simulation data in Dataset format simplifies postprocessing by providing a common format for the results of a variety of logging techniques. Using Dataset format stores the data as MATLAB timeseries objects, which you can process with MATLAB.

  • Signal logging and data stores use Dataset format.

  • Output and state logging use Dataset as the default format.

  • The default save format for the To File and To Workspace blocks is Timeseries.

Simulink® provides tools to convert logged data to Dataset format.

To determine which approach to use for logging signal data, see Export Simulation Data.


OutportCreate output port for subsystem or external output
To FileWrite data to file
To WorkspaceWrite data to workspace


expand all

Simulink.sdi.markSignalForStreamingTurn logging on or off for a signal
Simulink.sdi.getSignalInputProcessingModeGet setting of Input Processing signal property
Simulink.sdi.setSignalInputProcessingModeSpecify value for Input Processing signal property
Simulink.SimulationData.createStructOfTimeseriesCreate structure of timeseries data to load as simulation input for bus
Simulink.SimulationData.forEachTimeseriesCall function on each timeseries object
Simulink.SimulationData.signalLoggingSelectorOpen Signal Logging Selector
Simulink.SimulationData.DatasetRef.getDatasetVariableNamesList names of Dataset variables in MAT-file
getAsDatastoreGet representation of element from referenced Dataset object
setNameSpecify name of logging data units
Simulink.ModelDataLogs.convertToDatasetConvert logging data from Simulink.ModelDataLogs format to Simulink.SimulationData.Dataset format
Simulink.SimulationData.updateDatasetFormatLoggingConvert model and its referenced models to use Dataset format for signal logging


expand all

Simulink.SimulationOutputAccess simulation results
Simulink.SimulationData.DatasetCreate Simulink.SimulationData.Dataset object
Simulink.SimulationData.SignalContainer for signal logging information
Simulink.SimulationData.DatasetRefCreate Simulink.SimulationData.DatasetRef object for inputs and outputs of Simulink models
Simulink.SimulationData.BlockPathFully specified Simulink block path
Simulink.SimulationData.StateState logging element
Simulink.SimulationData.UnitStore units for simulation data
Simulink.SimulationData.LoggingInfoSignal logging override settings
Simulink.SimulationData.ModelLoggingInfoSignal logging override settings for a model
Simulink.SimulationData.SignalLoggingInfoSignal logging override settings for signal
Simulink.SimulationMetadataAccess metadata of simulation runs

Simulink Configuration Parameters


Simulation Data

Export Simulation Data

Export (log) simulation data as a baseline for analyzing and debugging a model.

Data Format for Logged Simulation Data

You can use many formats for logged data, including Dataset, MATLAB timeseries, arrays, and structures. Supported data formats vary between different logging techniques. However, Dataset format is available for all logging techniques.

Dataset Conversion for Logged Data

To convert a workspace variable that contains data that was logged in a format other than Dataset format to use Dataset format, use a Simulink.SimulationData.Dataset constructor.

Work with Big Data for Simulations

Log, load, and analyze big data for simulations.

Limit Amount of Exported Data

Reduce the amount of data logged during a simulation.

Log Data to Persistent Storage

Store logged simulation data to persistent storage in a MAT-file.

Load Big Data for Simulations

Load big data as simulation input.

Analyze Big Data from a Simulation

Access simulation data logged to persistent storage for analysis in MATLAB.

Log Signal Data That Uses Units

Log signal data that uses units by using Dataset or Timeseries logging format for signal logging, the To File block, and the To Workspace block.

Model Configuration Parameters: Data Import/Export

Use the Data Import/Export category of model configuration parameters to specify the simulation results to log and how to format and display the logging output.

Simulation State

State Information

How blocks use the state information for calculating the output signal value for the current simulation step.

Save State Information

Save state information for logged states for each simulation step during a simulation.

MATLAB Workspace

Limit Amount of Exported Data

Reduce the amount of data logged during a simulation.

Samples to Export for Variable-Step Solvers

Control how much output the simulation generates when your model uses a variable-step solver. Use the Output options configuration parameter.

Signal Logging

Export Signal Data Using Signal Logging

To capture signal data from a simulation, you can use signal logging. Mark the signals that you want to log and enable signal logging for the model.

Configure a Signal for Logging

Mark the signals that you want to log simulation data for.

View the Signal Logging Configuration

View the signals that are marked for signal logging.

Enable Signal Logging for a Model

To log signals marked for signal logging, set the Signal logging configuration parameter.

Override Signal Logging Settings

For a specific simulation run, override the signal logging settings for individual signals marked for logging.

View and Access Signal Logging Data

View and access the signal logging data for a completed or paused simulation.

Convert Logged Data to Dataset Format

To convert a workspace variable that contains data that was logged in a format other than Dataset format to use Dataset format, use a Simulink.SimulationData.Dataset constructor.

Log Signals in For Each Subsystems

Use signal logging in For Each subsystems.

Data Stores

Log Data Stores

Configure a data store for logging so that you can view the data stored in a simulation run.

Featured Examples