Main Content

sdo.getStateFromModel

Initial state for estimation from Simulink model

    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.

    example

    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.

    Input Arguments

    collapse all

    Model name, specified as a character vector or string. The model must be open.

    Example: 'sdoAircraft'

    Data Types: char | string

    Block path of the block containing the required state, specified as a character vector, string. or cell array of character vectors or a string array.

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

    Example: {'sdoAircraft/Actuator Model', ... 'sdoAircraft/Controller/Proportional plus integral compensator'}

    Data Types: char | string

    Output Arguments

    collapse all

    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.

    Dependencies

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

    Version History

    Introduced in R2011b