sampleSummary
Class: matlab.unittest.measurement.MeasurementResult
Namespace: matlab.unittest.measurement
Create table of summary statistics from MeasurementResult
array
Syntax
T = sampleSummary(R)
Description
Input Arguments
Results array from running a measurement experiment on a test
suite, specified as a MeasurementResult
array.
Output Arguments
Measurement sample summary, returned as a table. The table contains
the following columns: Name
, SampleSize
, Mean
, StandardDeviation
, Min
, Median
,
and Max
.
Examples
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
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)