getVariable
Return value of variable in the model workspace of a model
Description
returns the value of the variable whose name is varValue = getVariable(mdlWks,varName)varName that
exists in the model workspace represented by the
Simulink.ModelWorkspace object
mdlWks.
If the value of the target variable is a handle to a handle object (such as
Simulink.Parameter),
getVariable returns a copy of the handle. Changes you make
to the variable in the model workspace or to the returned variable
(variableValue) affect both variables.
To return a deep copy of the handle object, use the copy
method of the object. To modify a handle object that you store in a model workspace,
it is a best practice to use both the getVariable and
assignin methods (see Modify Property Value of Handle Object).
Examples
Input Arguments
Output Arguments
Alternatives
Return multiple values from a model workspace by using a Simulink.data.DataConnection object function.
mw = Simulink.data.connect("myModel.slx") set(mw,{'e','f'},{5,6}); get(mw,{'e','x','f'})
ans =
1x3 cell array
{[5]} {[<missing>]} {[6]}Version History
Introduced in R2012a
See Also
get_param | Simulink.ModelWorkspace | Simulink.data.connect | set | get