Set variables for a simulation through SimulationInput object, in
in = in.setVariable( assigns a
'Name', 'Value')Value to variable Name. You can add
multiple variables to the model using the same SimulationInput object.
in = in.setVariable(
assigns the 'Name', 'Value','Workspace', 'ModelName')Value to variable Name.
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 methods. 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.
While using the setVariable method, you can specify only one
variable at a time.
You can use getVariable('VariableName') method to get the value
of variable and the removeVariable('VariableName') method to
remove variable from the Simulink.SimulationInput object
For information on using nonscalar variables, structure variables and parameter objects, see Sweep Nonscalars, Structures, and Parameter Objects.
applyToModel | loadVariablesFromMATFile | parsim | setBlockParameter | setExternalInput | setInitialState | setModelParameter | setPostSimFcn | setPreSimFcn | Simulation
Manager | Simulink.SimulationInput | validate