Main Content


Package: sdo

Initial state for estimation from Simulink model


s = sdo.getStateFromModel(modelname,blockpath)
s = sdo.getStateFromModel(modelname)


s = sdo.getStateFromModel(modelname,blockpath) creates a state parameter object for the state of a specified block in a Simulink® model. Use the state object to either specify the initial-state value in an experiment or estimate it.

s = sdo.getStateFromModel(modelname) creates state parameter objects for all the states in the model.

Input Arguments


Simulink model name, specified as a character vector or string. For example, 'sdoAircraft'.

The model must be open.


Block path of the block containing the required state, specified as a character vector or string. For example, 'sdoAircraft/Actuator Model'.

To specify multiple blocks, use a cell array of character vectors or a string array.

Output Arguments


Model state, returned as a param.State object.

s.Value is the initial value of the state in the model.

When you use the syntax s = sdo.getStateFromModel(modelname,blockpath), s contains the state of the corresponding block.

If blockpath specifies multiple blocks, then sdo.getStateFromModel returns a vector of param.State objects.


collapse all

blockpath = {'sdoAircraft/Actuator Model', ...
 'sdoAircraft/Controller/Proportional plus integral compensator'};
s = sdo.getStateFromModel('sdoAircraft',blockpath);
modelname = 'sdoAircraft';
s = sdo.getStateFromModel(modelname);

s is a vector containing nine param.State objects, which represent all the states of the sdoAircraft model.

Version History

Introduced in R2011b