Main Content

getCheckResults

Access specific Model Advisor check results

Since R2024b

    Description

    CheckResults = getCheckResults(Results) returns all Model Advisor analysis check results specified by Results. Alternatively, you can access results for all checks from the CheckResults property of the ModelAdvisor.SystemResult objects in Results.

    CheckResults = getCheckResults(Results,checkID) returns the Model Advisor analysis results for the check specified by checkID.

    example

    CheckResults = getCheckResults(Results,Name=Value) specifies option using one or more name-value arguments. For example, to return Model Advisor check results with the Warning status, set Status to Warning.

    example

    Examples

    collapse all

    Run Model Advisor for the check Check root model Inport block specifications on the sldemo_mdlref_basic model and get the results.

    Open the sldemo_mdlref_basic model.

    openExample("sldemo_mdlref_basic");

    Use Model Advisor to run the check on sldemo_mdlref_basic.

    res = ModelAdvisor.run("sldemo_mdlref_basic","Check root model Inport block specifications")
    res =
    
      1×1 cell array
    
        {1×1 ModelAdvisor.SystemResult}

    Model Advisor returns a ModelAdvisor.SystemResult object for the sldemo_mdlref_basic model.

    Get the ModelAdvisor.SystemResult object to use directly.

    results = res{1};

    Get the results of the Check root model Inport block specifications check.

    Outcome = getCheckResults(results,'Check root model Inport block specifications')
      Outcome = 
    
      CheckResult with properties:
    
               System: 'sldemo_mdlref_basic'
              CheckID: 'mathworks.design.RootInportSpec'
           InstanceID: ''
            CheckName: 'Check root model Inport block specifications'
               Status: 'Passed'
           ResultText: 'Passed'
        ResultDetails: [0×0 ModelAdvisor.ResultDetail]

    The function returns the results for the Check root model Inport block specifications check as a ModelAdvisor.CheckResult object.

    Run Model Advisor for the checks Check for display of block parameter and Check length of model file name on the vdp model and get the results based on their execution status.

    Open the vdp model.

    openExample("vdp");

    Use Model Advisor to run the checks on vdp.

    res = ModelAdvisor.run("vdp",{'mathworks.maab.db_0140','mathworks.jmaab.jc_0241'})
    res =
    
      1×1 cell array
    
        {1×1 ModelAdvisor.SystemResult}

    Model Advisor returns a ModelAdvisor.SystemResult object for the vdp model.

    Get the ModelAdvisor.SystemResult object to use directly.

    results = res{1};

    Get the results of the checks based with the Warning execution status:

    CheckDetails1 = getCheckResults(results,Status="Warning")
      CheckDetai1s1 = 
    
      CheckResult with properties:
    
               System: 'vdp'
              CheckID: 'mathworks.maab.db_0140'
           InstanceID: ''
            CheckName: 'Check for display of block parameter'
               Status: 'Warning'
           ResultText: '↵↵Check for display of block parameter↵↵....'
        ResultDetails: [1×6 ModelAdvisor.ResultDetail]

    The function returns the results of checks with a Warning execution status obtained during Model Advisor analysis as a ModelAdvisor.CheckResult object.

    Get the results for specific checks with the execution status Passed or Failed.

    Outcome2 = getCheckResults(res,CheckID={'mathworks.maab.db_0140','mathworks.jmaab.jc_0241'},Status={'Passed','Failed'})
      Outcome2 = 
    
      CheckResult with properties:
    
               System: 'vdp'
              CheckID: 'mathworks.jmaab.jc_0241'
           InstanceID: ''
            CheckName: 'Check length of model file name'
               Status: 'Passed'
           ResultText: '↵Identify long model file names.↵↵Passed ↵↵↵↵Model name is valid.↵↵'
        ResultDetails: [1×1 ModelAdvisor.ResultDetail]

    The function returns the results of checks obtained during Model Advisor analysis for the ModelAdvisor.CheckResult object with a Passed or Failed status for the checks listed.

    Input Arguments

    collapse all

    Analysis results, specified as a cell array of ModelAdvisor.SystemResult objects. The cell array contains ModelAdvisor.SystemResult objects for each system.

    Check ID associated with the check, specified as a character vector or string scalar.

    Example: "mathworks.jmaab.jc_0231"

    Name-Value Arguments

    collapse all

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: OutCome = getCheckResults(res,Status="Passed");

    Operational or execution status, specified as a string scalar, a character vector, or cell array of character vectors.

    Example: "Not Run"

    Example: {'Passed','Warning'}

    List of check IDs for the Model Advisor checks, specified as a string scalar, a character vector, or cell array of character vectors. For information on how to find check IDs, see Find Model Advisor Check IDs.

    Example: "mathworks.jmaab.jc_0241"

    Example: {'mathworks.maab.db_0140','mathworks.jmaab.jc_0241'}

    Output Arguments

    collapse all

    Model Advisor check results, returned as a cell array of ModelAdvisor.CheckResult objects.

    Version History

    Introduced in R2024b

    expand all