createInputDataFile

Class: sltest.testmanager.TestCase
Package: sltest.testmanager

Create file as basis for test case input signal data

Description

example

input = createInputDataFile(tc,file) creates an input file for a test case. The file includes the signals based on the inport blocks in the model specified for the test case tc. You enter the time and signal data either in Microsoft® Excel® or, for MAT-files, using the signal editor in the Test Manager.

For information on the file format the Test Manager uses for Microsoft Excel files, see Format Test Case Data in Excel.

input = createInputDataFile(tc,file,Name,Value) uses additional arguments specified by one or more Name,Value pair arguments.

Examples

expand all

Create the input file template for a test case, using the Excel file format. Name the sheet for the template Optics. Creating the file also adds it as input in the test case. After you create the file, edit it to populate it with signal data.

% Create test file
tf = sltest.testmanager.TestFile('Excel Input Test File');

% Create test suite and test case
ts = createTestSuite(tf,'Excel Test Suite');
tc = createTestCase(ts,'baseline','Excel Input Test Case');

% Assign the system under test to the test case
setProperty(tc,'Model','sltestExcelExample');

% Generate Excel file template and add it to Inputs section, specifying the sheet name
input = createInputDataFile(tc,'C:\MyHomeDir\myexcel.xlsx','Sheet','Optics');

Input Arguments

expand all

Test case that you want to create the template input file from, specified as a sltest.testmanager.TestCase object.

Name and path of MAT-file or Microsoft Excel to create, specified as a character vector.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'Sheet','mysheet','Range','C1:F10','CreateIterations',false
Pairs for MAT-Files and Microsoft Excel Files

expand all

Option to create a table iteration from the input, specified as Boolean.

Example: 'CreateIterations',false

Pairs Only for Microsoft Excel Files

expand all

Name to give the sheet in the new Excel file, specified as a character vector.

Example: 'Sheet','testinputs'

Ranges of cells to add the inputs to in the sheet, specified as a character vector. You can specify 'Range' only if you also specify 'Sheet'.

Example: 'Range','B2:C30'

Output Arguments

expand all

Test input, returned as an sltest.testmanager.TestInput object.

Introduced in R2018a