Main Content

States

Description

Saves state data to the specified variable in the MATLAB® workspace during simulation.

Category: Data Import/Export

Settings

Default: Off, xout

On

Log state data to the MATLAB workspace during simulation.

Specify the name of the variable used to store states data. See State Information for more information.

Off

Do not log state data during simulation.

Tips

  • Specify the format for the logged states data using the Format parameter.

  • To log fixed-point states data, log states data using the Dataset format.

  • When you log states data using the Dataset format, states data streams to the Simulation Data Inspector during simulation.

  • Dataset format does not support:

    • Rapid accelerator simulation

    • Logging states information inside a function-call subsystem

    • Code generation

  • The state logging variable is empty when you enable states logging for a model that has no states.

  • If you log states data in a format other than Dataset, you can convert the logged data to Dataset format. Converting the data to Dataset makes it easier to post process with other logged data. For more information, see Dataset Conversion for Logged Data.

  • If you log states data in Array format while also logging time or in Structure with time format, check the Record logged workspace data in Simulation Data Inspector parameter to view the data in the Simulation Data Inspector after simulation.

Command-Line Information

Parameter: SaveState
Value: 'on' | 'off'
Default: 'off'
Parameter: StateSaveName
Type: character vector
Value: any valid value
Default: 'xout'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo recommendation
Safety precautionNo recommendation

Related Topics