Main Content

createInputDataFile

Class: sltest.testmanager.TestCase
Namespace: sltest.testmanager

Create file as basis for test case input signal data

Description

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 Input, Baseline, and Other Test Case Data Formats in Excel.

example

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

example

Examples

expand all

This example shows how to create an 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..

load_system("sltestExcelExample.slx")

tf = sltest.testmanager.TestFile("Excel Input Test File");
ts = createTestSuite(tf,"Excel Test Suite");
tc = createTestCase(ts,"baseline","Excel Input Test Case");

setProperty(tc,"Model","sltestExcelExample");

input = createInputDataFile(tc,"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.

Note

In the generated Excel file, except for the last dimension, cells containing a zero value are not written because zeros are implicit in the MATLAB language. For string data, an empty string is written, and for enumerated data, the default value is written. This approach improves the performance of reading and writing Excel files.

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: '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.

Version History

Introduced in R2018a