sdo.getValueFromModel
Get design variable value from model
Description
gets the value of a design variable in a Simulink® model. param_value
= sdo.getValueFromModel(modelname
,param_des
)
Examples
Get Current Design Variable Value from Model
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
modelname
— Model name
character vector | string
Model name, specified as a character vector or string. The model must be open.
Example: 'sdoAircraft'
Data Types: char
| string
param_des
— Design variables
param.Continuous
| param.Discrete
| character vector | string
Design variables, specified as:
A
param.Continuous
orparam.Discrete
object for one variable, or a vector of such parameter objects for multiple variables. To create these parameter objects, usesdo.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 thevalue
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 namedController
used in a top-level model, useparam_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
param_value
— Design variable
cell array | variable value
Design variable in the model, returned as a variable value or cell array of multiple variable values.
Version History
Introduced in R2011b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)