SimulinkTe​stにてベースライン​基準の結果(各端子名​とそのステータス情報​)を取得したいですが​、 ワークスペースに出力​かコマンドで取得する​方法はありますでしょ​うか?

4 views (last 30 days)
MathWorks Support Team
MathWorks Support Team on 9 Mar 2023
SimulinkTestにて、ベースライン基準の結果(各端子名とそのステータス情報)を取得したいですが、
コマンドを教えてください。

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 9 Mar 2023
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

More Answers (0)

Categories

Find more on Results, Reporting, and Test File Management in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!