Main Content

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 CheckResultsObjs property of a System.Result object.

    Properties

    expand all

    Model or subsystem that the Model Advisor analyzes, specified as a character vector.

    Data Types: char

    Status of Model Advisor check, specified as either:

    • "Failed"

    • "Incomplete"

    • "Justified"

    • "NotRun"

    • "Passed"

    • "Warning"

    Data Types: string

    Model Advisor check ID, specified as a character vector.

    Data Types: char

    Name of Model Advisor check, specified as a character vector.

    Data Types: char

    Examples

    collapse all

    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 checkCheck 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
        numPass
        numFail
        numNotRun
        numWarn
        numJustified
        CheckResultObjs

    Model Advisor returns a ModelAdvisor.SystemResult object for each model. The property CheckResultObjs contains the ModelAdvisor.CheckResult objects.

    View the ModelAdvisor.CheckResult object for one of the models.

    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 generateReport.

    Version History

    Introduced in R2015b

    expand all