| SystemTest™ | ![]() |
| On this page… |
|---|
After you run a test , the SystemTest software will automatically populate the MATLAB workspace with a variable called stresults. This variable provides access to the test results object, which is useful for comparing the results of separate test runs and for postprocessing test results.
Note You can also view and postprocess test results in the Test Results Viewer if you use the Visualize and plot saved results by launching the Test Results Viewer option in Test Properties. See Using the Test Results Viewer for more information about using the viewer. |
You access the results using the stresults variable. To see an example, use the Fault Tolerant Fuel Control System demo.
To open the demo in the SystemTest software, type the following at the MATLAB command line:
systemtest demosystest_fuelctrl
Run the test by clicking the Run button on the SystemTest toolbar.
To view the results after the test runs, return to MATLAB and type:
stresults
The test results object looks like the following for the Fault Tolerant Fuel Control System demo:

The summary shows the number of iterations that ran, the names of the test vectors included in the test, the saved results you specified in Save Results, the dataset array, and generated artifacts.
NumberOfIterations reflects how many iterations actually executed when the test ran. This will match what is reflected in the SystemTest software in the Main Test node of the Test Browser if all iterations ran. If any iterations stopped or errored out, this will show only the number that did execute.
TestVectorNames is a 1-by-N string cell array containing the test vector names. The values are an alphabetical list of test vector names.
SavedResultNames is a 1-by-N string cell array containing the test result names. The values are an alphabetical list of test result names.
ResultsDataSet is the dataset array storing the test vector and test result values for each iteration. See Accessing the dataset Array for information on accessing the test results data.
Artifacts provides links to SystemTest-generated documents, such as the test report. You can open the report by clicking the link. If your test includes a model coverage report, that would also be included here.
You can see a complete list of test results object properties before looking at the actual test results data. At the command line, type:
get(stresults)
In the example using the Fault Tolerant Fuel Control System demo, you see the following properties:

In addition to information that is also included in the summary, this includes derived results names, start time, stop time, tags, and user data.
DerivedResultNames contains values if you created any derived results using the Test Results Viewer. In the previous example there are no derived results, so the value is {}. If there were derived results, this property would contain an alphabetical list of their names.
StartTime provides the time the test was started in the form of a MATLAB clock vector.
StopTime provides the time the test was stopped in the form of a MATLAB clock vector.
TestFile stores the full path and name of the test that generated the test results. If the test has been saved, the value will contain the full path and name of the test. If the test has not yet been saved, the value will show only the test name.
Tag displays any string you specified using the set function. It is a descriptive string used for labeling purposes. By default, this property is empty.
UserData is a property for storing user data. It is used to store any arbitrary MATLAB data you would like to associate with the test results object. By default, this property is empty.
The ResultsDataSet property contains the test results data in the form of a dataset array. This is what you set up using the Saved Results node in the Test Browser. See Saving Test Results for more information on setting up saved results.
To access the test results data:
After running a test, use the stresults variable to view the test results object summary, as described in the previous section.
To access the ResultsDataSet property, type:
stresults.ResultsDataSet
or
get(stresults, 'ResultsDataSet')
This returns the test results data in the form of a dataset array.
In the Fault Tolerant Fuel Control System demo example, a portion of the test results data looks like this:

In the dataset array, each row represents a test iteration, labeled using the convention of ['I' + Iteration_Number]. The previous example shows the first 10 iterations. Test vector values are listed first, in alphabetical order, as shown, followed by test results, listed in alphabetical order, as shown in the following figure.

Notice that this example shows the test vectors list for the last two iterations (I95 and I96), and the beginning of the display of the test result values. There are five results, shown in alphabetical order. The display wraps in MATLAB, so the fifth result is shown after all the iterations for the first four.
In this example, the value for AvgAirFuel is 14.4466 for the first iteration, 11.8858 for the second iteration, etc.
![]() | Accessing Test Results from the MATLAB Command Line | Working with Test Results | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |