sdo.getParameterFromModel

Design variable for optimization

Syntax

p_des = sdo.getParameterFromModel(modelname,paramname)
p_des = sdo.getParameterFromModel(modelname)

Description

p_des = sdo.getParameterFromModel(modelname,paramname) creates an object from a Simulink® model parameter that you can tune to satisfy design requirements during optimization. The model must be open.

p_des = sdo.getParameterFromModel(modelname) creates model parameter objects for all the parameters in the model.

Input Arguments

modelname

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

paramname

Model parameter name, specified as a character vector or string for one parameter. For multiple parameters, specify as a cell array of character vectors or a string array. 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 the top-level model, use p_des = sdo.getParameterFromModel('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.getParameterFromModel('TopLevelModel','TopLevelModel/ControlBlock:Ki'). Here, ControlBlock is the block name in the referenced model.

Output Arguments

p_des

A param.Continuous object for one parameter or an array of objects for multiple parameters.

If paramname is not specified, then p_des contains all the parameters of the model.

The Value property of the object is set to the current value of the model parameter.

Examples

collapse all

load_system('sldo_model1_stepblk');

p_des = sdo.getParameterFromModel('sldo_model1_stepblk','Kp');
paramname = {'Kp','Ki','Kd'};

load_system('sldo_model1_stepblk');

p_des = sdo.getParameterFromModel('sldo_model1_stepblk',paramname);
load_system('sldo_model1_stepblk');
p_des = sdo.getParameterFromModel('sldo_model1_stepblk');
Introduced in R2011b