Access Model Advisor check results
View Model Advisor check results obtained by using the
To access the properties of a
CheckResult object, access the
CheckResultsObjs property of a
system — Model or subsystem that Model Advisor analyzes
Model or subsystem that the Model Advisor analyzes, specified as a character vector.
status — Model Advisor check status
Status of Model Advisor check, specified as either:
checkID — Model Advisor check ID
Model Advisor check ID, specified as a character vector.
checkName — Model Advisor check name
Name of Model Advisor check, specified as a character vector.
Access Model Advisor Results
This example shows how to run the check Check
root model Inport block specifications on the model
sldemo_mdlref_basic and its referenced model
sldemo_mdlref_counter, and then access the results.
Open the example model
sldemo_mdlref_basic. In the MATLAB® Command Window, enter:
Advisor.Application object that you can use to run Model
Advisor checks across the model reference hierarchy in
app = Advisor.Manager.createApplication();
Specify which model or subsystem to analyze. For this example, specify the model
sldemo_mdlref_basic as the root of the Model Advisor
setAnalysisRoot(app,Root = "sldemo_mdlref_basic");
Suppose that you only want to run the check Check root model Inport block specifications.
By default, the
Advisor.Application object is set up to run each
check instance in the current Model Advisor configuration and has
all check instances selected. Clear the check
instances to remove all check instances from the Model
Now there are no checks selected for Model Advisor analysis.
Specify that you want Model Advisor to run the check Check root model Inport block specifications by finding and using the check instance ID.
checkID = "mathworks.design.RootInportSpec"; instanceIDs = getCheckInstanceIDs(app,checkID); instanceID = instanceIDs(1); selectCheckInstances(app,ID = instanceID);
Now the checkCheck root model Inport block specifications is selected for Model Advisor analysis.
Run the Model Advisor analysis.
Model Advisor runs the check Check root model Inport block
specifications on both
Get the results from the Model Advisor analysis.
res = getResults(app)
res = 1×2 SystemResult array with properties: system Type numPass numFail numNotRun numWarn numJustified CheckResultObjs
Model Advisor returns a
ModelAdvisor.SystemResult object for each
model. The property
CheckResultObjs contains the
ModelAdvisor.CheckResult object for one of the
checkResult = res(1).CheckResultObjs
checkResult = 1×2337 CheckResult array with properties: system status checkID checkName taskID
You can use the properties of
ModelAdvisor.CheckResult to inspect
the results from the Model Advisor analysis. Note that you can also generate a Model
Advisor report for the Model Advisor analysis. For more information, see
Version HistoryIntroduced in R2015b
status property uses string values
The valid values for the
status property were updated to the string values:
status property has different values
The valid values for the
status property were updated to the
status property has different value for warnings
status property uses a value of:
'Warning'in the check result from
'Warn'in the check result from