Main Content

Format

Description

Select the data format for saving states, output, and final states data.

Category: Data Import/Export

Settings

Default: Dataset

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 individual state or output is stored in a timeseries object by default.

Array

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.

Structure

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.

Tips

  • 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.

  • Dataset format does not support rapid accelerator simulation.

  • For states logging, Dataset format does not support:

    • Logging states information inside a function-call subsystem

    • Code generation

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

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

    • Be all real or all complex

    • Have 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.

Command-Line Information

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

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo recommendation
Safety precautionNo recommendation

Related Topics