setVariable
Set variable value on SimulationInput
object
Syntax
Description
simIn = setVariable(
sets the variable simIn
,varName
,varValue
)varName
with the value
varValue
on the Simulink.SimulationInput
object simIn
. You can configure a
Simulink.SimulationInput
object with multiple variables. When
you use the setVariable
function, specify only one variable at
a time.
simIn = setVariable(
assigns the value simIn
,varName
,varValue
,'Workspace',wkspace
)varValue
to variable
varName
. Variables that are defined through the SimulationInput
object are placed in the
global workspace scope by default. The term global
workspace is specific to the Simulink.SimulationInput
object and
its functions. Variables in the global workspace scope take precedence if a variable
with the same name exists in the base workspace or the data dictionary. The
variables in the model workspace take precedence over the global workspace scope. To
change the value of a model workspace variable, set the scope by specifying the
model name when you add the variable to the SimulationInput
object.
You can use getVariable(simIn,varName)
to get a variable value
and removeVariable(simIn,varName)
to remove a variable from the
Simulink.SimulationInput
object
For information on using nonscalar variables, structure variables, and parameter objects, see Sweep Nonscalars, Structures, and Parameter Objects.
Examples
Input Arguments
Output Arguments
Version History
Introduced in R2017a