Main Content


Initial state for estimation from Simulink model



    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.


    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.

    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.


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

    Version History

    Introduced in R2011b