Main Content


Class: sltest.testmanager.TestIteration
Namespace: sltest.testmanager

Set model variable override




setVariable(obj,'Name',varName,'Source',srcName,'Value',value,'SimulationIndex',simIndex) sets a model variable override for the test iteration. Specify the sltest.testmanager.TestIteration object, and then specify the variable name, source, override value, and optionally, the simulation index. The method overrides the variable in the test iteration and does not permanently change the model variable.

Input Arguments

expand all

The test iteration you want to apply the override to, specified as a sltest.testmanager.TestIteration object.

Name of the variable you want to override, specified as a character vector.

The source of the variable to override, specified as a character vector. For non-real-time test cases, the possible sources can be 'base workspace', 'model workspace', or the name of a data dictionary, such as 'data.sldd' or model workspace name.

For real-time test cases, the possible sources are model element paths or empty character vectors. If a block parameter value is being overridden in a test iteration, use the full block path as the variable source. If variables are used for one or more block parameters, use an empty character vector as the source name. An empty vector is used because in the real-time application, the variable is a global variable, so you do not need to specify its source.

Value of the variable to override.

Simulation index of an equivalence test case, specified as 1 or 2, where 1 is Simulation 1 and 2 is Simulation 2.

Example: 'SimulationIndex',2


expand all

setVariable(obj,'Name','g','Source','base workspace','Value',33);

Version History

Introduced in R2016a