Main Content

addParameterOverride

Class: sltest.testmanager.ParameterSet
Package: sltest.testmanager

Add parameter override to parameter set

Syntax

ovr = addParameterOverride(ps,Name,Value)

Description

ovr = addParameterOverride(ps,Name,Value) adds a parameter override to a parameter set and returns a parameter override object, sltest.testmanager.ParameterOverride.

Input Arguments

expand all

Parameter set to which you want to add the override, specified as a sltest.testmanager.ParameterSet object.

Name-Value Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'Value',5.2

Name of the parameter to override, specified as a string or character vector. Name is a required input.

Value of the parameter to override, specified as a numeric or a string. If the value is a string, it is evaluated as a MATLAB® expression when the test executes. Value is a required input.

Block path of the parameter to override, specified as a string or character vector. A block path is required only if the parameter to override is a block parameter. The combination of Name and BlockPath properties must be unique within a parameter set.

Workspace of the parameter to override, specified as a string or character vector.

Output Arguments

expand all

Parameter override added to the parameter set, returned as an sltest.testmanager.ParameterOverride object.

Examples

expand all

% Open the model for this example
openExample('sldemo_absbrake');

% Create the test file, test suite, and test case structure
tf = sltest.testmanager.TestFile('API Test File');
ts = createTestSuite(tf,'API Test Suite');
tc = createTestCase(ts,'baseline','Baseline API Test Case');

% Remove the default test suite
tsDel = getTestSuiteByName(tf,'New Test Suite 1');
remove(tsDel);

% Assign the system under test to the test case
setProperty(tc,'Model','sldemo_absbrake');

% Capture the baseline criteria
baseline = captureBaselineCriteria(tc,'baseline_API.mat',true);

% Test a new model parameter by overriding it in the test case
% parameter set
ps = addParameterSet(tc,'Name','API Parameter Set');
po = addParameterOverride(ps,'m',55);
Introduced in R2015b