Main Content

getCheckInstanceIDs

Class: Advisor.Application
Namespace: Advisor

Obtain check instance IDs

Description

Obtain the check instance ID for a check using the check ID. 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. The check ID is a static identifier that does not change.

example

CheckInstanceIDs = getCheckInstanceIDs(app) returns a cell array of check instance IDs.

example

CheckInstanceIDs = getCheckInstanceIDs(app,CheckID) returns the instance ID or instance IDs associated with a check. getCheckInstanceIDs returns multiple check instance IDs if a check appears in multiple folders in the Model Advisor tree.

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 ID associated with Model Advisor check, specified as a character vector.

Example: 'mathworks.design.UnconnectedLinesPorts'

Output Arguments

expand all

Check instance IDs, returned as a cell array.

Examples

expand all

This example shows how to create an Advisor.Application object, set the root of the Model Advisor analysis, and find each of the selected 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 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");

Select each of the check instances in the current Model Advisor configuration.

selectCheckInstances(app);

Get the check instance IDs for each check instance in the current Model Advisor configuration.

CheckInstanceIDs = getCheckInstanceIDs(app);

This example shows how to create an Advisor.Application object, set the root of the Model Advisor analysis, and find the check instance IDs associated with the check Check root model Inport block specifications.

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 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");

Specify that you want Model Advisor to run the check Identify unconnected lines, input ports, and output ports by finding and using the check instance ID.

checkID = "mathworks.design.UnconnectedLinesPorts";
instanceIDs = getCheckInstanceIDs(app,checkID)

You can use the check instance ID to select or deselect the checks that run during Model Advisor analysis. For more information, see the methods selectCheckInstances and deselectCheckInstances.

For more information on running Model Advisor using the Advisor.Application object, see Advisor.Application.

Alternatives

In the left-hand pane of the Model Advisor window, right-click the check and select Send Check Instance ID to Workspace.

Version History

Introduced in R2015b