MATLAB Examples

Capture Baseline Data from Iterations

This example shows how to create a baseline test by capturing data from a test case with table iterations. You create the iterations from Signal Builder groups in the model. Before running the example, navigate to a writable folder on the MATLAB® path.

1. Open the model. At the command line, enter

Model = 'sltestCar';
open_system(fullfile(matlabroot,'examples','simulinktest',Model));

2. Create a test file that contains iterations, and open the Test Manager. At the command line, enter

tf = sltest.testmanager.TestFile('IterationBaselineTest');
sltest.testmanager.load(tf.Name);
sltest.testmanager.view;

3. In the Test Manager, right-click the test case and select Rename. Rename the test case Baseline Test.

4. In the System Under Test section, for Model, enter sltestCar.

5. Select the signals for the baseline data:

  1. In the Simulation Outputs section, click Add. The Signal Selection dialog box appears.
  2. In the model canvas, select the output torque and vehicle speed signals. The signals appear in the Signal Selection dialog box.
  3. In the dialog box, select both signals and click Add.
  4. The signals appear in the Logged Signals table.

6. Add iterations for the test case:

  1. Expand the Iterations section of the test case.
  2. Expand the Table Iterations section and click Auto Generate.
  3. In the dialog box, select Signal Builder Group. Click OK.
  4. The table lists the iterations corresponding to the four Signal Builder groups.

7. Capture baseline data for the iterations:

  1. In the Baseline Criteria section, click the arrow next to Capture, and select Capture for Iterations.
  2. Specify a location for the baseline data files.
  3. Click Create.

The model simulates for all Signal Builder groups. The baseline data for output_torque and vehicle_speed are captured in four MAT files. Also, each baseline data set is added to its corresponding iterations in the table.