Main Content


Class: sltest.testmanager.TestCase
Namespace: sltest.testmanager

Add parameter set


pset = addParameterSet(tc,Name,Value)


pset = addParameterSet(tc,Name,Value) adds a parameter set to the test case and returns a parameter set object, sltest.testmanager.ParameterSet.

Input Arguments

expand all

Test case that you want to add the parameter set to, specified as a sltest.testmanager.TestCase object.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'SimulationIndex',2

Name of the parameter set, specified as a character vector. This name is the label shown in the test case parameter set table. If you do not specify a name, the function creates an auto-generated unique name.

The full name and path of the .m file or MAT-file, which contains the parameter values, specified as a character vector. If no parameter file path is given, then the function creates an empty parameter set.

Simulation number to which the parameter set applies, specified as an integer, 1 or 2. This parameter applies to the simulation test case where there are two simulations. For baseline and simulation test cases, the simulation index is 1.

Excel spreadsheet names for which you want to create parameter sets, specified as a string array. If you do specify Sheets, a parameter set is created for each sheet in the file.

Output Arguments

expand all

Parameter set, returned as an sltest.testmanager.ParameterSet object.


expand all

% Open the model for this example

% 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');

% Assign the system under test to the test case

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

Version History

Introduced in R2015b