Loads the model initial states from a workspace before simulation begins.
Category: Data Import/Export
Default: Off, xInitial
Simulink® software loads initial states from a workspace.
Specify the name of a variable that contains the initial state values, for example, a variable containing states saved from a previous simulation.
Use the structure or structure-with-time option to specify initial states if you want to accomplish any of the following:
Associate initial state values directly with the full path name to the states. This eliminates errors that could occur if Simulink software reorders the states, but the initial state array is not correspondingly reordered.
Assign a different data type to each state's initial value.
Initialize only a subset of the states.
Initialize the states of a top model and the models that it references
See Load State Information for more information.
The Initial state parameter does not load initial state data from a data dictionary. When a model uses a data dictionary and you disable model access to the base workspace, the Initial State parameter still has access to resolve variables in the base workspace.
Simulink software does not load initial states from a workspace.
The initial values that the workspace variable specifies override the initial values that the model specifies (the values that the initial condition parameters of those blocks in the model that have states specify).
Selecting the Initial state check box does not result in Simulink initializing discrete states in referenced models.
Avoid using an array for an initial state. If the order of the elements in the array does not
match the order in which blocks initialize, the simulation can produce
unexpected results. To promote deterministic simulation results, use the
InitInArrayFormatMsg diagnostic default setting of
warning
or set the diagnostic to
error
.
Instead of array format for the initial state, consider using a
Simulink.SimulationData.Dataset
object, structure,
structure with time, or an operating point.
If you use a format other than Dataset
,
you can convert the logged data to Dataset
format.
Converting the data to Dataset
makes it easier
to postprocess with other logged data. For more information, see Dataset Conversion for Logged Data.
If you use Dataset
format, you can specify the discrete
state bus type by setting the state label to DSTATE_NVBUS (nonvirtual bus)
or DSTATE_VBUS (virtual bus).
Parameter: LoadInitialState |
Value: 'on' | 'off' |
Default: 'off' |
Parameter: InitialState |
Type: variable (character vector) or vector |
Value: any valid value |
Default: 'xInitial' |
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | No recommendation |
Safety precaution | No recommendation |