Main Content

getstatestruct

Obtain state values from operating point

Description

example

x= getstatestruct(op)extracts a structure of state values from a specified operating point object. You can use the state structure to set initial state values for your Simulink®model.

Examples

collapse all

Open thescdplanemodel and create an operating point. You can also compute a trimmed operating point or obtain an operating point snapshot.

mdl ='scdplane'; open_system(mdl) op = operpoint(mdl);

Extract the state values from the operating point.

xInitial = getstatestruct(op);

Extract the input values from the operating point.

uInitial = getinputstruct(op);

To view the values of the states or inputs within this structure, use dot notation. For example, view the input values.

uInitial.signals.values
ans = 0

Set the initial state values in the model.

set_param(mdl,'LoadInitialState','on','InitialState','xInitial')

Set the initial input values in the model.

set_param(mdl,'LoadExternalInput','on','ExternalInput','uInitial')

Input Arguments

collapse all

Operating point for a Simulink model, specified as anOperatingPoint,OperatingSpec, orOperatingReportobject. You can also specify a homogeneous array of any of these objects.

Output Arguments

collapse all

State values, returned as a structure with the following fields.

  • signals— State values and information

  • time— Simulation time for state values, returned as0.

Ifopis an array,xis returned as a structure array with the same dimensions asop.

版本嗨story

Introduced before R2006a