addParameterSet
类: sltest.testmanager.TestCase
命名空间: sltest.testmanager
添加参数集
语法
pset = addParameterSet(tc,Name,Value)
说明
向测试用例添加参数集并返回参数集对象 pset
= addParameterSet(tc
,Name,Value
)sltest.testmanager.ParameterSet
。
输入参数
tc
— 测试用例
sltest.testmanager.TestCase
对象
想要添加参数集的测试用例,指定为 sltest.testmanager.TestCase
对象。
名称-值参数
将可选的参量对组指定为 Name1=Value1,...,NameN=ValueN
,其中 Name
是参量名称,Value
是对应的值。名称-值参量必须出现在其他参量后,但参量对组的顺序无关紧要。
在 R2021a 之前,使用逗号分隔每个名称和值,并用引号将 Name
引起来。
示例: 'SimulationIndex',2
Name
— 参数集名称
自动生成的唯一名称 (默认) | 字符向量
参数集的名称,指定为字符向量。该名称是测试用例参数集表中显示的标签。如果您未指定名称,该函数将自动创建一个唯一的名称。
FilePath
— 参数集名称和文件路径
字符向量
包含参数值的 .m 文件或 MAT 文件的完整名称和路径,指定为字符向量。如果没有给出参数文件路径,那么该函数将创建一个空参数集。
SimulationIndex
— 仿真数量
1
(默认) | 2
参数集适用的仿真编号,指定为整数,1
或 2
。此参数适用于有两个仿真的仿真测试用例。对于基线和仿真测试用例,仿真索引是 1
。
Sheets
— Excel® 电子表格工作表名称
字符串数组
您想要为其创建参数集的 Excel 电子表格名称,指定为字符串数组。如果您确实指定了 Sheets
,则会为文件中的每个工作表创建一个参数集。
输出参量
pset
— 参数集
sltest.testmanager.ParameterSet
对象
参数集,作为 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 中推出
另请参阅
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)