Return initial state data of block diagram
x0 = Simulink.BlockDiagram.getInitialState('
x0 = Simulink.BlockDiagram.getInitialState(' returns
the initial state data of the block diagram specified by the input
model. You can use this initial
state data as the initial state for simulating a model or to provide
an initial state condition to the linearization commands. To specify
the initial state for a simulation, use the
argument or the Data Import/Export > Initial state configuration
To specify the format for the initial state data, use the
argument. The default format is
'StructureWithTime'. Alternatively, you can
set the initial state format using the Data
Import/Export > Format configuration parameter.
If format is
'Dataset', then the
For other format settings, the function returns a structure of the form:
time: 0 signals: [1xn struct]
n is the number of states contained
in the model, including any models referenced by Model blocks. The
is a structure of the form:
values: [1xm double] dimensions: [1x1 double] label: [char array] blockName: [char array] inReferencedModel: [bool] sampleTime: [1x2 double]
values — Numeric array of
m is the number
of states in the signal
dimensions — Length of the
label — Indication of whether
the state is continuous (
CSTATE) or discrete. If
the state is discrete:
The name of the discrete state is shown for S-function blocks.
The name of the discrete state is shown for those built-in blocks that assign their own names to discrete states.
DSTATE is used in all other cases.
blockName — Full path to
block associated with this state
inReferencedModel — Indication
of whether the state originates in a model referenced by a Model block
1) or in the top model (
sampleTime — Array containing
the sample time and offset of the block that owns the state
Using this function to return the initial state data simplifies specifying initial state values for models with multiple states. Each state is associated with the full path to its parent block.