Manage Test Results

Introduction

After accessing test results data in the form of a dataset array, you can work with the data in MATLAB®. This feature is useful for comparing the test results data of separate test runs and for postprocessing of test results data.

One advantage to accessing test results data at the command line is that all of the MATLAB plotting tools are available to use on the test results data. You can plot the data using any of the plot types MATLAB offers.

Another major use of the datatset array is to quickly see the results when you use a Limit Check element in your test. You can see whether each iteration passed or failed, and what the value was.

Manage Test Results in Native Format

You can use indexing to extract data of the dataset in its native format. You can index by string or value.

For example, you can assign a variable to represent the dataset, then access one column of the set using that variable. In the case of the Fault Tolerant Fuel Control System example, it could look like the following.

  1. Create a variable to refer to the test results dataset array:

    SetA = stresults.ResultsDataSet;

    In this example the test results data is assigned to the variable SetA.

  2. Specify the desired columns of data by referencing the name of the test result.

    SetA.AvgFuelRate

    This indexed into the column called AvgFuelRate.

    Note:   When extracting data in its native format, the test results are always returned as a cell array.

MATLAB displays the contents of that column of data, as shown in this example:

The first 10 iterations are shown in the example.

Manage Test Results as a Dataset Array

You can also choose to manage the test results as a dataset array, refining the data as finely as needed. Suppose you just want to get the average fuel rate for iterations 4 through 8. Use standard MATLAB indexing, as shown in the next example:

The value returned represents the average fuel rate for iterations 4 through 8, in the form of a dataset array.

Plot Results Data

To demonstrate plotting results:

  1. Open the example in the SystemTest™ software by typing the following at the MATLAB command line:

    systemtest simple_demo
  2. Run the test by clicking the Run button on the SystemTest toolbar.

  3. View the results summary using stresults at the command line.

    You can see that this test has one test vector for a signal, called signal, and three saved results. The result for Y is the signal's value for a given test run.

    Note that in the example shown here, the Test Report was enabled before the test was run, so the link to the report is displayed in the results. By default the report is not enabled. To see the link to the report in this example (or any test you run), enable the report before running the test. To enable the report, click on the test name in the Test Browser, then select the Generate report option on the Output Files tab of the Properties pane.

  4. Look at the test results dataset by typing the following:

    stresults.ResultsDataSet

    The first 10 iterations are shown here:

    You can see the test vector signal followed by the three results, including the one of interest in this example, Y.

  5. Create a variable called SetB for the results dataset for ease of use in working with the data.

    SetB = stresults.ResultsDataSet;
  6. Create variables for the signal (the test vector) and the Y test result.

    signalA = SetB.signal;
    VarA = SetB.Y;
  7. Plot the signal. Because Y represents the current value of the signal for each iteration of the test, plotting the signal against Y shows the values of the signal throughout the test.

    plot([signalA{:}], [VarA{:}])

    The plot command produces a line plot, as shown here. You can use any type of plot that MATLAB offers.

    To use another plot type, such as a scatter plot, replace the plot command.

    scatter([signalA{:}], [VarA{:}])

Was this topic helpful?