Documentation Center

  • Trials
  • Product Updates

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 string inside single quotes (' ').

The model must be open.

blockpath

Block path of the block containing the required state, specified as a string inside single quotes (' ').

To specify multiple blocks, use a cell array of block path strings.

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

expand all

Get States from Model

modelname = 'sdoAircraft';
open_system(modelname);

blockpath = {'sdoAircraft/Actuator Model', ...
 'sdoAircraft/Controller/Proportional plus integral compensator'};

s = sdo.getStateFromModel(modelname,blockpath);

Get All Model States

modelname = 'sdoAircraft';
open_system(modelname);

s = sdo.getStateFromModel(modelname);

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

See Also

|

Was this topic helpful?