Main Content



Specify data format for logging states, output, and final states data.

Category: Data Import/Export


Default: Dataset


Logged states and outputs are each stored in a Simulink.SimulationData.Dataset object. Each Dataset object contains an element for each individual state or output. The data for each state or output is stored in a timeseries object by default except variable-size signal data. Variable-size signal data is always stored in a timetable object that contains a cell array of signal values for each time step.


Logged data is stored in a matrix. Each row in the matrix corresponds to a simulation time step, and each column corresponds to a state or output. The order of the states and outputs in the matrix depends on the block sorted order, which can change from one simulation to the next. Do not use Array format to log bus data.


State and output data each log to a structure. The states structure contains a structure for each block in the model that has a state. The outputs structure contains a structure for each root-level Outport block in the model.

Structure with time

The data logs to a structure with a time field and a signals field. The time field contains a vector of simulation times. The signals field contains the same data as the Structure format.


  • When you log states and output data using Dataset:

    • You can work with logged data in MATLAB® without a Simulink® license.

    • Logging supports saving multiple data values for a given time step, which can be required for logging data in a For Iterator Subsystem, a While Iterator Subsystem, and Stateflow®.

    • Logged data automatically streams to the Simulation Data Inspector during simulation.

    • You can log variable-size signals using root-level Outport blocks.

  • Dataset format does not support:

    • Code generation.

    • Logging states inside a function-call subsystem.

    • Logging states during rapid accelerator simulations.

  • To use Array format, all logged states and outputs must be:

    • All scalars or all vectors (or all matrices for states)

    • All real or all complex

    • The same data type

    Use another format if the outputs and states in your model do not meet these conditions.

  • The format specified for the Format parameter does not apply to final states data.

Programmatic Use

Parameter: SaveFormat
Value: 'Array' | 'Structure' | 'StructureWithTime' | 'Dataset'
Default: 'Dataset'

Recommended Settings

DebuggingNo impact
TraceabilityNo impact
EfficiencyNo recommendation
Safety precautionNo recommendation

Related Topics