www.gusucode.com > simulinktest 案例源码程序 matlab代码 > simulinktest/GetAssessmentsProgrammaticExample.m
%% Get Assessments from a Simulation % This example shows how to simulate a model with |verify| statements and % obtain assessment results via the programmatic interface. %% Get the Assessment Set and One Assessment Result % % 1. Open the model. open_system(fullfile(matlabroot,'examples','simulinktest','sltestRollRefTestExample.slx')) % Turn the command line warning off for verify() statements warning off Stateflow:Runtime:TestVerificationFailed %% % 2. Run the model. s = sim('sltestRollRefTestExample'); %% % 3. Get the assessment set. as = sltest.getAssessments('sltestRollRefTestExample'); %% % 4. Get assessment 3 from the assessment set. as3 = get(as,3); %% Display Results of the Assessment Set and Assessment Result %% % 1. Get summary of the assessment set. asSummary = getSummary(as) %% % 2. Display the result of assessment 3. disp(as3) %% % 3. Find untested or failed results in the assessment set. asFailUntested = find(as,'Result',slTestResult.Fail,'-or','Result',slTestResult.Untested) %% % 4. Find assessments under the Test Assessment block, using a regular % expression. assessBlock = find(as,'-regexp','BlockPath','.[Aa]ssess')