sampleSummary
类: matlab.unittest.measurement.MeasurementResult
命名空间: matlab.unittest.measurement
基于 MeasurementResult
数组创建摘要统计量表
语法
T = sampleSummary(R)
输入参数
对测试套件运行测量试验得出的结果数组,指定为 MeasurementResult
数组。
输出参量
测量样本摘要,以表格形式返回。表格包含以下列:Name
、SampleSize
、Mean
、StandardDeviation
、Min
、Median
和 Max
。
示例
在您的当前工作文件夹中创建一个基于类的测试,preallocationTest.m
,用于对不同的预分配方法进行比较。
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
创建一个测试套件。
suite = testsuite('preallocationTest');
构造一个采集不定测量值样本数的计时试验,并运行这些测试。
import matlab.perftest.TimeExperiment
experiment = TimeExperiment.limitingSamplingError;
R = run(experiment,suite);
Running preallocationTest .......... .......... .......... .......... .......... ..... Done preallocationTest __________
基于结果数组 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
版本历史记录
在 R2017a 中推出
另请参阅
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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)