Main Content

sdo.getStateFromModel

Package: sdo

Initial state for estimation from Simulink model

Syntax

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

Description

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

modelname

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

The model must be open.

blockpath

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

s

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.

Examples

collapse all

load_system('sdoAircraft');
blockpath = {'sdoAircraft/Actuator Model', ...
 'sdoAircraft/Controller/Proportional plus integral compensator'};
s = sdo.getStateFromModel('sdoAircraft',blockpath);
modelname = 'sdoAircraft';
load_system(modelname);
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