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:
- In the Simulation Outputs section, click Add. The Signal Selection dialog box appears.
- In the model canvas, select the output torque and vehicle speed signals. The signals appear in the Signal Selection dialog box.
- In the dialog box, select both signals and click Add.
- The signals appear in the Logged Signals table.
6. Add iterations for the test case:
- Expand the Iterations section of the test case.
- Expand the Table Iterations section and click Auto Generate.
- In the dialog box, select Signal Builder Group. Click OK.
- The table lists the iterations corresponding to the four Signal Builder groups.
7. Capture baseline data for the iterations:
- In the Baseline Criteria section, click the arrow next to Capture, and select Capture for Iterations.
- Specify a location for the baseline data files.
- 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.