Main Content

sdo.getValueFromModel

Get design variable value from model

    Description

    example

    param_value = sdo.getValueFromModel(modelname,param_des) gets the value of a design variable in a Simulink® model.

    Examples

    collapse all

    load_system('sldo_model1_stepblk');
    p_value = sdo.getValueFromModel('sldo_model1_stepblk','Kp');

    Alternatively, type:

    p_des = sdo.getParameterFromModel('sldo_model1_stepblk','Kp');
    p_value = sdo.getValueFromModel('sldo_model1_stepblk',p_des);

    Input Arguments

    collapse all

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

    Example: 'sdoAircraft'

    Data Types: char | string

    Design variables, specified as:

    • A param.Continuous or param.Discrete object for one variable, or a vector of such parameter objects for multiple variables. To create these parameter objects, use sdo.getParameterFromModel.

    • Character vector or string for one variable. For multiple variables, specify as cell array of character vectors or a string array. For example, {'Kp','Ki'}. When you specify variables this way, you must also provide the value argument.

      If a parameter is in a referenced model, the variable name must include the path. For instance, if a parameter Ki is in a referenced model named Controller used in a top-level model, use param_des = 'Controller:Ki'.

      If Ki is a model argument in a referenced model, provide block path from top-level model as follows, param_des = 'TopLevelModel/ControlBlock:Ki'. Here, ControlBlock is the block name in the referenced model.

    Example: p_des

    Data Types: char | string

    Output Arguments

    collapse all

    Design variable in the model, returned as a variable value or cell array of multiple variable values.

    Version History

    Introduced in R2011b