Main Content

sampleSummary

クラス: matlab.unittest.measurement.MeasurementResult
名前空間: matlab.unittest.measurement

配列 MeasurementResult から要約統計量の table を作成

構文

T = sampleSummary(R)

説明

T = sampleSummary(R) は、配列 MeasurementResult から要約統計量の table を作成します。

入力引数

すべて展開する

テスト スイートで測定実験を実行した結果の配列。配列 MeasurementResult として指定します。

出力引数

すべて展開する

測定サンプルの要約。table として返されます。この table には、NameSampleSizeMeanStandardDeviationMinMedianMax の列があります。

すべて展開する

現在の作業フォルダーに、さまざまな事前割り当てメソッドを比較するクラスベースのテスト 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 から要約統計量の table を作成します。

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 で導入

参考