Log Dataset data to file


Log data to MAT-file.

Category: Data Import/Export


Default: 'off'


Enables logging data that uses Dataset format to a MAT-file.

Use this feature when logging large amounts of data that can cause memory issues. For details, see Log Data to Persistent Storage.

Specify a character vector for the path to the file to use for logging signals and states. Do not use a file name from one locale in a different locale.

When you log data to a file, data does not stream to visualization tools like the Simulation Data Inspector.


Disables logging data to a MAT-file.


  • To use the Log Dataset data to file option:

    • Select one or more of these kinds of logging:

      • States

      • Final states

      • Signal logging

      • Output

      • Data stores

    • If you are logging states or output data, set the Format parameter to Dataset.

    • If you select the Final states parameter, clear the Save final operating point parameter.

  • To access in the MAT-file the Simulink.SimulationData.Dataset data for a logging variable (for example, the logsout variable for signal logging data), you can create a Simulink.SimulationData.DatasetRef object. Using a Simulink.SimulationData.DatasetRef object to access signal logging and states data stored in the MAT-file loads the data into memory incrementally (signal by signal).

  • You can load the MAT-file contents into memory without creating a Simulink.SimulationData.DatasetRef object. You can load either the whole file or a Dataset object in that file using the MATLAB® load command. However, to load data signal by signal or load individual signals incrementally, use a Simulink.SimulationData.DatasetRef object.

  • Each time you simulate a model without using parallel simulation, Simulink® overwrites the contents of the MAT-file unless you change the name of the file between simulations. For details, see Save Logged Data from Successive Simulations.


Select the Log Dataset data to file check box before entering the path to the MAT-file for logging.

Command-Line Information

Parameter: LoggingToFile
Value: 'on' | 'off'
Default: 'off'
Parameter: LoggingFileName
Value: any valid value
Default: 'out.mat'

Recommended Settings

DebuggingNo impact
TraceabilityNo impact

No recommendation

Safety precaution

No recommendation

See Also

| |

Related Topics