sampleSummary
Class: matlab.unittest.measurement.MeasurementResult
Package: matlab.unittest.measurement
Create table of summary statistics from MeasurementResult
array
Syntax
T = sampleSummary(R)
Description
creates
a table of summary statistics from a T
= sampleSummary(R
)MeasurementResult
array.
Input Arguments
R
— Results array
MeasurementResult
array
Results array from running a measurement experiment on a test
suite, specified as a MeasurementResult
array.
Output Arguments
T
— Measurement sample summary
table
Measurement sample summary, returned as a table. The table contains
the following columns: Name
, SampleSize
, Mean
, StandardDeviation
, Min
, Median
,
and Max
.
Examples
Generate Table of Summary Statistics
In your current working folder, create a class-based test, preallocationTest.m
, that compares different methods of preallocation.
classdef preallocationTest < matlab.perftest.TestCase methods(Test) function testOnes(testCase) x = ones(1,1e7); end function testIndexingWithVariable(testCase) id = 1:1e7; x(id) = 1; end function testIndexingOnLHS(testCase) x(1:1e7) = 1; end function testForLoop(testCase) for i=1:1e7 x(i) = 1; end end end end
Create a test suite.
suite = testsuite('preallocationTest');
Construct a time experiment with a variable number of sample measurements, and run the tests.
import matlab.perftest.TimeExperiment
experiment = TimeExperiment.limitingSamplingError;
R = run(experiment,suite);
Running preallocationTest .......... .......... .......... .......... .......... ..... Done preallocationTest __________
Create a table of summary statistics from the result array R
.
T = sampleSummary(R)
T = 4×7 table array Name SampleSize Mean StandardDeviation Min Median Max __________________________________________ __________ ________ _________________ ________ ________ ________ preallocationTest/testOnes 4 0.02649 0.00086703 0.025583 0.026426 0.027526 preallocationTest/testIndexingWithVariable 16 0.13356 0.014525 0.11803 0.12716 0.15946 preallocationTest/testIndexingOnLHS 13 0.073571 0.0073962 0.065024 0.073216 0.086889 preallocationTest/testForLoop 6 0.74768 0.03897 0.69934 0.75511 0.79957
Version History
Introduced in R2017a
See Also
Apri esempio
Si dispone di una versione modificata di questo esempio. Desideri aprire questo esempio con le tue modifiche?
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)