ModelAdvisor.CheckResult
Access Model Advisor check results
Description
View Model Advisor check results obtained by using the run
method.
Creation
To access the properties of a CheckResult
object, access the
CheckResults
property of a SystemResult
object or use
the getCheckResults
function.
Properties
System
— Model or subsystem that Model Advisor analyzes
character vector
Model or subsystem that the Model Advisor analyzes, specified as a character vector.
Data Types: char
Status
— Model Advisor check status
"Failed"
| "Incomplete"
| "Justified"
| "NotRun"
| "Passed"
| "Warning"
Status of Model Advisor check, specified as either:
"Failed"
"Information"
"Incomplete"
"Justified"
"NotRun"
"Passed"
"Warning"
Data Types: string
CheckID
— Model Advisor check ID
character vector
Model Advisor check ID, specified as a character vector.
Data Types: char
CheckName
— Model Advisor check name
character vector
Name of Model Advisor check, specified as a character vector.
Data Types: char
InstanceID
— Check instance ID
character vector
Check instance ID, specified as a character vector. The instance ID represents the instance of a check in the Model Advisor configuration.
ResultText
— Check results in text
character vector
Check results in text, specified as a character vector.
ResultDetails
— Check result details
ModelAdvisor.ResultDetail
object
Check result details, specified as a ModelAdvisor.ResultDetail
object.
Examples
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:
openExample("sldemo_mdlref_basic")
Create an Advisor.Application
object that you can use to run Model
Advisor checks across the model reference hierarchy in
sldemo_mdlref_basic
.
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
analysis.
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
Advisor
analysis.
deselectCheckInstances(app);
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 check Check root model Inport block specifications is selected for Model Advisor analysis.
Run the Model Advisor analysis.
run(app);
Model Advisor runs the check Check root model Inport block
specifications on both sldemo_mdlref_basic
and
sldemo_mdlref_counter
.
Get the results from the Model Advisor analysis.
res = getResults(app)
res = 1×2 SystemResult array with properties: System Type Summary CheckResults
Model Advisor returns a ModelAdvisor.SystemResult
object for each
model. The property CheckResults
contains the
ModelAdvisor.CheckResult
objects.
View the ModelAdvisor.CheckResult
object for one of the
models.
checkResult = res(1).CheckResults
checkResult = 1×2337 CheckResult array with properties: System Status CheckID InstanceID CheckName ResultText ResultDetails
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 generateReport
.
Version History
Introduced in R2015bR2024b: New object properties InstanceID
, ResultText
, and ResultDetails
The ModelAdvisor.CheckResult
contains these new properties:
InstanceID
– Check instance IDResultText
– Check result in text formatResultDetails
– Check result detailsModelAdvisor.ResultDetail
objects
R2022b: status
property uses string values
The valid values for the status
property were updated to the string values:
"Failed"
"Incomplete"
"Justified"
"NotRun"
"Passed"
"Warning"
R2022a: status
property has different values
The valid values for the status
property were updated to the
enumerated values:
Failed
Incomplete
Justified
NotRun
Passed
Warning
R2021a: status
property has different value for warnings
The status
property uses a value of:
'Warning'
in the check result fromModelAdvisor.run
'Warn'
in the check result fromAdvisor.Application.run
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)