map
类: sltest.testmanager.TestInput
命名空间: sltest.testmanager
将测试输入映射到在测系统
语法
map(input,Name,Value)
说明
map(
将测试输入数据 input
,Name
,Value
)input
映射到在测系统。
输入参数
input
— 测试输入
sltest.testmanager.TestInput
对象
要映射的测试输入,指定为 sltest.testmanager.TestInput
对象。
名称-值参数
将可选的参量对组指定为 Name1=Value1,...,NameN=ValueN
,其中 Name
是参量名称,Value
是对应的值。名称-值参量必须出现在其他参量后,但参量对组的顺序无关紧要。
在 R2021a 之前,使用逗号分隔每个名称和值,并用引号将 Name
引起来。
示例: 'Mode',4,'CustomFunction','mapfcn'
Mode
— 映射模式
0
| 1
| 2
| 3
| 4
映射模式,指定为由 'mode'
和与所需映射模式对应的整数组成的逗号分隔的对:
0
— 区模块名称1
— 模块路径2
— 信号名称3
— 端口顺序(索引)4
— 自定义
有关映射模式的更多信息,请参阅 Map Root Inport Signal Data。
示例: 'Mode',2
CustomFunction
— 自定义映射函数名称
字符向量
用于自定义映射的函数名称,指定为由 'customFunction'
和字符向量组成的逗号分隔的对。此参量是可选的,并且仅当 mode
设置为 4
时有效。
示例: 'CustomFunction','mapfcn'
CompileModel
— 用于映射的模型编译
true
(默认) | false
执行输入映射时编译或不编译模型的选项,指定为由 'CompileModel'
和 false
或 true
组成的逗号分隔的对。
示例: 'CompileModel',false
示例
添加 Microsoft® Excel® 数据作为输入
此示例显示如何从 Microsoft® Excel® 电子表格添加数据并将其映射到测试用例。仅添加并映射包含数据的两张工作表。
加载示例模型
open_system('slexAutotransRootInportsExample');
创建新的测试文件
tf = sltest.testmanager.TestFile('input_test_file.mldatx');
获取测试套件和测试用例对象
ts = getTestSuites(tf); tc = getTestCases(ts);
添加示例模型作为在测系统
setProperty(tc,'Model','slexAutotransRootInportsExample');
将 Excel® 数据添加到输入部分并指定要添加的工作表
excelfile = 'sltestExampleInputs.xlsx'; input = addInput(tc,excelfile,'Sheets',["Acceleration","Braking"]);
按模块名称映射工作表的输入信号
map(input(1),0); map(input(2),0);
版本历史记录
在 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)