Main Content

Log Dataset data to file

Option to log data that uses Dataset format to MAT file

Model Configuration Pane: Data Import/Export


Specify whether to log simulation data that uses the Dataset format to a MAT file.


off (default) | on

Simulation data logged using the Dataset format logs to the workspace and does not log to a MAT file.


Simulation data logged using Dataset format logs to a MAT file and does not log to the workspace. By default, the data is saved in a file with the name out.mat in the current working directory. To save the file in a different location or using a different filename, specify the path and filename in the text box.


  • To use the Log Dataset data to file option, select one or more of these types of data to log:

    • States

    • Final states

    • Signal logging

    • Output

    • Data stores

    • Stateflow® states and data

    To log states or output data to the MAT file, set the Format parameter to Dataset.

    To log Final states data to the MAT file, clear Save final operating point.

  • When the data in the MAT file fits into memory, use the load function to access the data.

  • When the data in the MAT file is too large to fit into memory, access the data in the MAT file using Simulink.SimulationData.DatasetRef and objects.

  • Except for parallel simulations, the software overwrites the contents of the MAT file during each simulation unless you change the name of the file between simulations. For details, see Save Logged Data from Successive Simulations.

Recommended Settings

The table summarizes recommended values for this parameter based on considerations related to code generation.

DebuggingNo impact
TraceabilityNo impact

No recommendation

Safety precaution

No recommendation

Programmatic Use

Parameter: LoggingToFile
Value: 'on' | 'off'
Default: 'off'
Parameter: LoggingFileName
Type: string | character vector
Value: valid path and file name
Default: 'out.mat'

Version History

Introduced in R2016a