setVariable
设置模拟的变量模拟Input
object,in
Description
in = in.setVariable(
assigns a'Name', 'Value'
)Value
to variableName
. You can add multiple variables to the model using the same模拟Input
object.
in = in.setVariable(
assigns the'Name', 'Value'
,'Workspace'
,'ModelName'
)Value
to variableName
. Variables that are defined through the模拟Input
object are placed in the全球工作区scope by default. The term全球工作区is specific to theSimulink.SimulationInput
object and its methods. Variables in the全球工作区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全球工作区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模拟Input
object.
While using thesetVariable
method, you can specify only one variable at a time.
You can usegetVariable('VariableName')
method to get the value of variable and theremoveVariable('VariableName')
method to remove variable from theSimulink.SimulationInput
object
For information on using nonscalar variables, structure variables and parameter objects, see扫描Nonscalars, Structures, and Parameter Objects.
Examples
Input Arguments
See Also
Simulink.SimulationInput
|parsim
|applyToModel
|setBlockParameter
|setModelParameter
|setInitialState
|setExternalInput
|validate
|setPreSimFcn
|setPostsimfcn.
|loadVariablesFromMATFile
|模拟Manager