SimulinkTestにてベースライン基準の結果(各端子名とそのステータス情報)を取得したいですが、 ワークスペースに出力かコマンドで取得する方法はありますでしょうか?
4 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2023 年 3 月 9 日
回答済み: MathWorks Support Team
2023 年 3 月 9 日
SimulinkTestにて、ベースライン基準の結果(各端子名とそのステータス情報)を取得したいですが、
コマンドを教えてください。

採用された回答
MathWorks Support Team
2023 年 3 月 9 日
getComparisonSignalResultsを使用することで、取得できます。
下記は、このAPIのドキュメントになりますので、ご確認頂けます。
https://jp.mathworks.com/help/releases/R2020a/sltest/ref/sltest.testmanager.comparisonrunresult.getcomparisonsignalresults.html
下記は、使用例になります。
お客様のMATLAB R2021a以上の環境(Simulink Testをインストールしている必要あり)で、そのままお試し頂けます。
%%
% Create the test file, test suite, and test case structure
tf = sltest.testmanager.TestFile('API Test File8');
ts = createTestSuite(tf,'API Test Suite');
tc = createTestCase(ts,'baseline','Baseline API Test Case');
% Remove the default test suite
%tsDel = getTestSuiteByName(tf,'New Test Suite 1');
tsDel = getTestSuiteByName(tf,'新規テスト スイート 1');
remove(tsDel);
% Assign the system under test to the test case
setProperty(tc,'Model','sldemo_absbrake');
% Capture the baseline criteria
baseline = captureBaselineCriteria(tc,'baseline_API.mat',true);
% Test a new model parameter by overriding it in the test case
% parameter set
ps = addParameterSet(tc,'Name','API Parameter Set');
po = addParameterOverride(ps,'m',55);
% Set the baseline criteria tolerance for one signal
sc = getSignalCriteria(baseline);
sc(1).AbsTol = 9;
% Run the test case and return an object with results data
ResultsObj = run(tc);
sltest.testmanager.view;
%
tcr = getTestCaseResults(ResultsObj);
cr2 = getComparisonResult(tcr);
cr2sig = getComparisonSignalResults(cr2);
%%
上記スクリプトを実行後、MATLABコマンドウインドウ上で、
>> cr2sig
cr2sig =
1×4 ComparisonSignalResult array with properties:
Outcome
Baseline
ComparedTo
Difference
上記より、4個のうちの2個目の信号名とステータスを
取得する際は下記になります。
% 信号名を取得
>> cr2sig(2).Baseline.Name
ans =
'yout.Vs (Baseline)'
% ステータを取得
>> cr2sig(2).Outcome
ans =
ComparisonSignalOutcomes enumeration
Failed
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Results, Reporting, and Test File Management についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!