Main Content

setAnalysisRoot

Class: Advisor.Application
Namespace: Advisor

Specify model reference hierarchy for Model Advisor analysis

Description

Specify the model reference hierarchy for an Application object analysis.

setAnalysisRoot(app,'Root',model) specifies model as the root of the Model Advisor analysis.

example

setAnalysisRoot(app,'Root',subsystem,'RootType','Subsystem') specifies the subsystem as the root of the Model Advisor analysis.

example

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.

Model name, specified as a character vector.

Example: setAnalysisRoot(app,'Root','sldemo_mdlref_basic')

Data Types: char

Subsystem path, specified as a character vector.

Example: setAnalysisRoot(app,'Root','sldemo_mdlref_basic/CounterA','RootType','Subsystem')

Data Types: char

Examples

expand all

This example shows how to create an Advisor.Application object and specify a model as the root of the Model Advisor analysis.

Open the example model sldemo_mdlref_basic. In the MATLAB® Command Window, enter:

openExample('sldemo_mdlref_basic');

The model sldemo_mdlref_basic is a parent model that contains three Model blocks: CounterA, CounterB, and CounterC. These blocks reference the same model, sldemo_mdlref_counter, which is a separate model and not a subsystem of 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);

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 on both sldemo_mdlref_basic and the referenced model sldemo_mdlref_counter.

This example shows how to create an Advisor.Application object and specify a subsystem as the root of the Model Advisor analysis.

Open the example model slexVariantManagement. In the MATLAB Command Window, enter:

openExample('slexVariantManagement')

Create an Advisor.Application object that you can use to run Model Advisor checks.

app = Advisor.Manager.createApplication();

Specify the subsystem Controller as the root of the Model Advisor analysis.

setAnalysisRoot(app,'Root','slexVariantManagement/Controller',...
'RootType','Subsystem');

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

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 on the Controller subsystem and its referenced models.

For more information, see Advisor.Application.

Version History

Introduced in R2015b