Main Content

deselectCheckInstances

Class: Advisor.Application
Namespace: Advisor

Clear check instances from Model Advisor analysis

Description

You can clear check instances from Model Advisor analysis. A check instance is an instantiation of a ModelAdvisor.Check object in the Model Advisor configuration. When you change the Model Advisor configuration, the check instance ID can change. To obtain the check instance ID, use the getCheckInstanceIDs method.

example

deselectCheckInstances(app) clears all check instances from Model Advisor analysis.

example

deselectCheckInstances(app,'IDs',checkInstanceIDs) clears check instances specified by checkInstanceIDs from Model Advisor analysis.

Input Arguments

expand all

Model Advisor application object, specified as an Advisor.Application object. You can use an Advisor.Application object to run Model Advisor checks on a model reference hierarchy. Create an Advisor.Application object by using the method Advisor.Manager.createApplication.

Check instances to clear from Model Advisor analysis, specified by a cell array of check instance IDs.

Example: deselectCheckInstances(app,'IDs',{'_SYSTEM_By Product_Simulink_mathworks.design.UnconnectedLinesPorts'})

Data Types: cell

Examples

expand all

This example shows how to create an Advisor.Application object, set the root of the Model Advisor analysis, and then clear check instances from the Model Advisor analysis.

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.

app = Advisor.Manager.createApplication();

Specify which model 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);

You can use the method selectCheckInstances to specify the checks that you want Model Advisor to run. For this example, specify that you want Model Advisor to run only 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);

Run the Model Advisor analysis.

run(app);

Model Advisor runs only the check Check root model Inport block specifications.

This example shows how to create an Advisor.Application object, set the root of the Model Advisor analysis, and then clear specific check instances from the Model Advisor analysis by using the deselectCheckInstances method and the check instance IDs.

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.

app = Advisor.Manager.createApplication();

Specify which model 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 do not 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. Find the check instance IDs for the check Check root model Inport block specifications and use the check instance ID to remove the check from the Model Advisor analysis.

checkID = 'mathworks.design.RootInportSpec';
instanceIDs = getCheckInstanceIDs(app,checkID);
deselectCheckInstances(app, 'IDs',instanceIDs);
The method getCheckInstanceIDs returns multiple check instance IDs because the check Check root model Inport block specifications appears in multiple folders in the Model Advisor tree.

If you run the Advisor.Application object, Model Advisor runs each of the checks in the current configuration, except for the check Check root model Inport block specifications. For more information, see Advisor.Application.

Version History

Introduced in R2015b