Documentation

Save Runtime 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.

Blocks

Outport Create output port for subsystem or external output
To File Write data to file
To Workspace Write data to workspace

Functions

Simulink.ModelDataLogs.convertToDataset Convert logging data from Simulink.ModelDataLogs format to Simulink.SimulationData.Dataset format
Simulink.SimulationData.signalLoggingSelector Open Signal Logging Selector
Simulink.SimulationData.updateDatasetFormatLogging Convert model and its referenced models to use Dataset format for signal logging
unpack Extract signal logging objects from signal logs and write them into MATLAB workspace
Simulink.SimulationData.createStructOfTimeseries Create a structure with MATLAB timeseries object leaf nodes
Simulink.SimulationData.Unit.setName Specify name of logging data units
Simulink.SimulationData.DatasetRef.getDatasetVariableNames List names of Dataset variables in MAT-file
who List names of top-level data logging objects in Simulink ModelDataLogs data log
whos List names and types of top-level data logging objects in Simulink ModelDataLogs data log

Classes

Simulink.SimulationData.Dataset Create Simulink.SimulationData.Dataset object
Simulink.SimulationData.DatasetRef Create Simulink.SimulationData.DatasetRef object
Simulink.SimulationData.BlockPath Fully specified Simulink block path
Simulink.SimulationData.Signal Container for signal logging information
Simulink.SimulationData.State State logging element
Simulink.SimulationData.Unit Store units for simulation data
Simulink.SimulationOutput Access object values of simulation results
Simulink.SimulationData.LoggingInfo Signal logging override settings
Simulink.SimulationData.ModelLoggingInfo Signal logging override settings for a model
Simulink.SimulationData.SignalLoggingInfo Signal logging override settings for signal
Simulink.SimulationMetadata Access metadata of simulation runs
Simulink.ModelDataLogs Container for signal data logs of a model
Simulink.SubsysDataLogs Container for subsystem signal data logs
Simulink.TimeInfo Provide information about time data in Simulink.Timeseries object
Simulink.Timeseries Store data for any signal except mux or bus signal
Simulink.TsArray Store data for mux or bus signal

Was this topic helpful?