Main Content

本页采用了机器翻译。点击此处可查看英文原文。

addParameterSet

类: sltest.testmanager.TestCase
命名空间: sltest.testmanager

添加参数集

语法

pset = addParameterSet(tc,Name,Value)

说明

pset = addParameterSet(tc,Name,Value) 向测试用例添加参数集并返回参数集对象 sltest.testmanager.ParameterSet

输入参数

全部展开

想要添加参数集的测试用例,指定为 sltest.testmanager.TestCase 对象。

名称-值参数

将可选的参量对组指定为 Name1=Value1,...,NameN=ValueN,其中 Name 是参量名称,Value 是对应的值。名称-值参量必须出现在其他参量后,但参量对组的顺序无关紧要。

在 R2021a 之前,使用逗号分隔每个名称和值,并用引号将 Name 引起来

示例: 'SimulationIndex',2

参数集的名称,指定为字符向量。该名称是测试用例参数集表中显示的标签。如果您未指定名称,该函数将自动创建一个唯一的名称。

包含参数值的 .m 文件或 MAT 文件的完整名称和路径,指定为字符向量。如果没有给出参数文件路径,那么该函数将创建一个空参数集。

参数集适用的仿真编号,指定为整数,12。此参数适用于有两个仿真的仿真测试用例。对于基线和仿真测试用例,仿真索引是 1

您想要为其创建参数集的 Excel 电子表格名称,指定为字符串数组。如果您确实指定了 Sheets,则会为文件中的每个工作表创建一个参数集。

输出参量

全部展开

参数集,作为 sltest.testmanager.ParameterSet 对象返回。

示例

全部展开

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

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

版本历史记录

在 R2015b 中推出