sampleSummary
类: matlab.unittest.measurement.MeasurementResult
命名空间: matlab.unittest.measurement
基于 MeasurementResult
数组创建摘要统计量表
语法
T = sampleSummary(R)
输入参数
R
— 结果数组
MeasurementResult
数组
对测试套件运行测量试验得出的结果数组,指定为 MeasurementResult
数组。
输出参量
T
— 测量样本摘要
表
测量样本摘要,以表格形式返回。表格包含以下列: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 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 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)