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.
Input Arguments
app
— Model Advisor application object
Advisor.Application
object
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
— Model name
character vector
Model name, specified as a character vector.
Example: setAnalysisRoot(app,'Root','sldemo_mdlref_basic')
Data Types: char
subsystem
— Subsystem path
character vector
Subsystem path, specified as a character vector.
Example: setAnalysisRoot(app,'Root','sldemo_mdlref_basic/CounterA','RootType','Subsystem')
Data Types: char
Examples
Specify Root Model as Analysis Root
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
.
Specify Subsystem as Analysis Root
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
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)