Format
Format for logged states, output, and final states data
Model Configuration Pane: Data Import/Export
Description
Specify format for logged states, output, and final states data. Signal logging and data store
logging always use the Dataset
format.
The choice of format does not affect the simulation results in terms of the system
behavior but can affect the content of the logged data. The
Dataset
format logs time data for each signal, so logged
values reflect the sample rate for each output and state. The
Structure
, Structure with
time
, and Array
formats share a single time
vector for all outputs and states, so the output and state data is logged using the
fundamental sample time for the model.
Settings
Dataset
(default) | Array
| Structure
| Structure with time
Dataset
Logged outputs, states, and final states are each stored in a
Simulink.SimulationData.Dataset
object. EachDataset
object contains an element for each individual state or output. By default, the data for each state or output is stored in atimeseries
object except variable-size signal data. Logged data for variable-size signals is always stored in atimetable
that contains a cell array of signal values for each time step. To specify whether to store data as atimeseries
object or as atimetable
, use the Dataset signal format parameter.You can process data logged using the
Dataset
format in MATLAB® without a Simulink® license.When you log states and output data using the
Dataset
format: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 top-level Outport blocks.
You can use state and operating point data as the initial state for simulation of a model that contains bus-valued states.
Dataset
format does not support:Code generation.
Logging states inside a function-call subsystem.
Logging states during rapid accelerator simulations.
Logging states in simulations deployed using Simulink Compiler™
Logging final states in rapid accelerator and deployed simulations if one or more states in the model has any of these data types:
half
string
Character vector
Fixed-point
Logging final states if a referenced model that simulates in a mode other than normal contains one or more states that have any of these data types:
half
string
Character vector
Fixed-point
Array
Logged outputs, states, and final states are each stored as 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.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.
Structure
Outputs, states, and final states are each stored as 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 top-level output port.
Structure with time
Outputs, states, and final states are each logged to a structure that contains a field for time data as well as a field for the output or states data. The
time
field contains a vector of simulation times. Thesignals
field contains the same data that is logged when you select theStructure
format.
Examples
Recommended Settings
The table summarizes recommended values for this parameter based on considerations related to code generation.
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | No recommendation |
Safety precaution | No recommendation |
Programmatic Use
Parameter: SaveFormat |
Value:
"Array" | "Structure" |
"StructureWithTime" | "Dataset" |
Default:
"Dataset" |
Version History
Introduced before R2006a