Package: sdo

Get design variable value from model


param_value = sdo.getValueFromModel(modelname,param_des)


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

Input Arguments


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


Design variables, specified as:

  • Character vector for one design variable. For multiple variables, specify as a cell array of character vectors or a string array. For example, {'Kp','Ki'}.

  • A param.Continuous object for one variable or a vector of objects for multiple variables, created using sdo.getParameterFromModel.

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 p_des = sdo.getValueFromModel('TopLevelModel','Controller:Ki').

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

Output Arguments


Design variable value in the model.

A cell array for multiple variable values.


collapse all

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);
Introduced in R2011b