Main Content

captureBaselineCriteria

R2026b

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

Capture baseline criteria and add to test case

Syntax

baseline = captureBaselineCriteria(tc,file,append)
baseline = captureBaselineCriteria(tc,file,append,Name=Value)

Description

baseline = captureBaselineCriteria(tc,file,append) runs the system under test and captures a baseline criteria set as a MAT file, Simulation Data Inspector MLDATX file, or Microsoft® Excel® file. The function returns a baseline criteria object, sltest.testmanager.BaselineCriteria. Use this function only if the test type is a baseline test case.

Note

If your model has multiple variant subsystems, capture independent baselines for each variant subsystem, instead of reusing a baseline.

baseline = captureBaselineCriteria(tc,file,append,Name=Value) uses additional options specified by one or more Name=Value arguments.

Input Arguments

expand all

Test case to capture baseline criteria in, specified as an sltest.testmanager.TestCase object.

File and pathname of the baseline criteria file, specified as a character vector. You can specify a MAT file, Microsoft Excel file, or MLDATX file, which is captured as a Simulation Data Inspector MLDATX file.

Specify an MLDATX file to capture baseline criteria for these types of data because MAT and Excel files do not support them:

  • Array of buses

  • Simscape™ Data

  • For each subsystem

Example: 'C:\MATLAB\baseline_API.mat'

Append baseline criteria if criteria already exists, specified as a Boolean. The Boolean true appends to existing criteria, and false replaces existing criteria.

Name-Value Arguments

expand all

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.

Example: Sheet='mysheet'

Name-Value Arguments for MAT Files, MLDATX files, and Microsoft Excel Files

expand all

Simulink release to capture the baseline data in, specified as a character vector or string array. Use a release specified in your preferences. For more information, see sltest.testmanager.getpref and sltest.testmanager.setpref.

Example: Release='R2024a'

Whether to capture baseline data for test case iterations, specified as a numeric or logical 1 (true) or 0 (false). Capturing baselines for iterations in MLDATX format is not supported.

Example: CaptureForIterations=true

Name-Value Arguments Only for Microsoft Excel Files

expand all

Name to sheet to capture baseline criteria to, specified as a character vector or string array.

Example: Sheet='testinputs'

Ranges of cells to capture baseline criteria to, specified as a character vector or string array. You can specify Range only if you also specify Sheet.

Example: Range='B2:C30'

Output Arguments

expand all

Baseline criteria added to the test case, returned as an sltest.testmanager.BaselineCriteria object.

Examples

expand all

% 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");

% Capture the baseline criteria
baseline = captureBaselineCriteria(tc,'baseline_API.mat',true);

Version History

Introduced in R2015b