map
Class: sltest.testmanager.TestInput
Namespace: sltest.testmanager
Map test input to system under test
Syntax
map(input)
map(___,Name,Value)
Description
map(
maps the test input data
input
)input
to the system under test. This
syntax uses the default mapping mode 0
, which
corresponds to the block name, and the default of compiling the
model when the inputs are mapped.
map(___,
maps the test input data Name
,Value
)input
to the system
under test.
Input Arguments
input
— Test input
sltest.testmanager.TestInput
object
The test input to map, specified as a sltest.testmanager.TestInput
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: 'Mode',4,'CustomFunction','mapfcn'
Mode
— Mapping mode
0
(default) | 1
| 2
| 3
| 4
Mapping mode, specified as the
comma-separated pair consisting of
'Mode'
and an integer
corresponding to the desired mapping mode.
Alternatively, you can enter just the mode value
without the 'Mode'
name. For
example, map(input,'Mode',1)
and map(input,1)
are
equivalent.
0
— Block name1
— Block path2
— Signal name3
— Port order (index)4
— Custom
For more information on mapping modes, see Map Root Inport Signal Data.
Example: 'Mode',2
CustomFunction
— Custom mapping function name
character vector
Name of function used for custom mapping,
specified as the comma-separated pair consisting
of 'CustomFunction'
and a
character vector. If you use a packaged function
for custom mapping, specify the name as
+packageName/functionName
, and
if the path has multiple layers, use a plus sign
with each layer above the function name (for
example,
+myFolder/+packageName/functionName
).
This argument is optional and valid only when
Mode
is set to
4
.
Example: 'CustomFunction','mapfcn'
Example: 'CustomFunction','+maps/mapfcn'
CompileModel
— Model compilation for mapping
true
(default) | false
Option to compile or not compile the model
when performing input mapping, specified as the
comma-separated pair consisting of
'CompileModel'
and
false
or
true
.
Example: 'CompileModel',false
Examples
Add Microsoft® Excel® Data as Input
This example shows how to add data from a Microsoft® Excel® spreadsheet and map it to a test case. Only the two sheets that have data are added and mapped.
Load the Example Model
open_system('slexAutotransRootInportsExample');
Create a New Test File
tf = sltest.testmanager.TestFile('input_test_file.mldatx');
Get the Test Suite and Test Case Objects
ts = getTestSuites(tf); tc = getTestCases(ts);
Add the Example Model as the System Under Test
setProperty(tc,'Model','slexAutotransRootInportsExample');
Add Excel® Data to Inputs Section and Specify Sheets to Add
excelfile = 'sltestExampleInputs.xlsx'; input = addInput(tc,excelfile,'Sheets',["Acceleration","Braking"]);
Use Default Mapping Mode to Map the Input Signals for the Sheets
map(input(1)); map(input(2));
Version History
Introduced in R2015b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)