Main Content

setVariable

Class: sltest.testmanager.TestIteration
Package: sltest.testmanager

Set model variable override

Syntax

setVariable(obj,'Name',varName,'Source',srcName,'Value',value,'SimulationIndex',simIndex)

Description

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', 'mask 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, which, if the source is a model parameter, might be an empty character vector.

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

Examples

expand all

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