Contents

sdo.setValueInModel

Package: sdo

Set design variable value in model

Syntax

sdo.setValueInModel(modelname,param_des)
sdo.setValueInModel(modelname,param_des,value)

Description

sdo.setValueInModel(modelname,param_des) sets the value of a parameter in an open Simulink® model to the Value property of the design variable param_des .

You generally use this command to update the Simulink model with optimized parameter values.

sdo.setValueInModel(modelname,param_des,value) sets the parameter to the value you specify.

Input Arguments

modelname

Simulink model name that uses the parameter, specified as a string inside single quotes (' ').

param_des

Design variable, specified as

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

  • A string inside single quotes (' ') for one variable or a cell array of strings for multiple variables.

    You must also specify the value argument.

value

Value to set for the design variable.

Use a cell array with the same number of elements as the number of variables in param_des for setting values of multiple design variables.

Examples

Change the design variable value in a model.

sldo_model1_stepblk;
p_des = sdo.getParameterFromModel('sldo_model1_stepblk','Kp');
p_des.Value = 1.1*p_des.Value;
sdo.setValueInModel('sldo_model1_stepblk',p_des);

The value of Kp is set to the Value property of p_des.

Was this topic helpful?