Advisor.getExclusion
Syntax
Description
displays the all exclusion information for the model.exclusionInfo
= Advisor.getExclusion(modelName
)
gets the exclusion information for an entity, like a block, subsystem, or Stateflow® element, in the model. The type of exclusion is specified by the
exclusionInfo
= Advisor.getExclusion(modelName
,filterType
,entityIdentifier
)filterType
argument. The entity is specified by the
entityIdentifier
argument.
Examples
Get Exclusions from Model
Add an exclusion to a model and then get the exclusion from the model.
Open the slexAircraftExample
model.
openExample('simulink_aerospace/AircraftLongitudinalFlightControlExample')
On the Simulink® canvas, click the entity that you want to exclude from Model Advisor
checks. For this example, click the Inport block named
u
.
Exclude the selected block from Model Advisor analysis by adding an exclusion to the block. In the MATLAB® Command Window, enter:
Advisor.addExclusion('slexAircraftExample','Block',gcb);
'Block'
specifies that exclusion needs to filter out a Simulink block and the function gcb
returns the path to the
block that you selected. For more information, see gcb
.Get the exclusions from the model by entering:
exclusions = Advisor.getExclusion('slexAircraftExample');
The exclusion that you add to the u
Inport block is the first and only element in
exclusions
.
exclusions(1)
ans = AdvisorFilterSpecification with properties: filteredItem: [1×1 advisor.filter.IFilter] metadata: [1×1 advisor.filter.Metadata] mode: Exclude commentThread: [1×0 advisor.filter.Metadata Sequence] type: Block id: 'slexAircraftExample:1' checks: [1×1 String Sequence]
Alternatively, you can view the exclusion in the Model Advisor Exclusion Editor by right-clicking the Simulink canvas and selecting Model Advisor > Open Model Advisor Exclusion Editor.
The Model Advisor Exclusion Editor shows a table with a row for the
u
Inport block exclusion. The Filter Identifier column
shows the pathname specified by the entityIdentifier
argument and
the Filter Type column shows the exclusion filter type specified by
filterType
argument. The Rationale and
Check ID(s) columns are associated with the
rationale
and checks
arguments.
Get Exclusion for Specific Simulink Block
Use the Advisor.addExclusion
function to exclude
a Simulink block from Model Advisor analysis.
Open the slexAircraftExample
model.
openExample('simulink_aerospace/AircraftLongitudinalFlightControlExample')
On the Simulink canvas, click the entity that you want to exclude from Model Advisor
checks. For this example, click the Inport block named
u
.
Exclude the selected block from Model Advisor analysis by adding an exclusion to the block. In the MATLAB Command Window, enter:
Advisor.addExclusion('slexAircraftExample','Block',gcb);
'Block'
specifies that exclusion needs to filter out a Simulink block and the function gcb
returns the path to the
block that you selected. For more information, see gcb
.Get the exclusion for the u
Inport block by
entering:
exclusion = Advisor.getExclusion('slexAircraftExample','Block',gcb)
exclusion = AdvisorFilterSpecification with properties: filteredItem: [1×1 advisor.filter.IFilter] metadata: [1×1 advisor.filter.Metadata] mode: Exclude commentThread: [1×0 advisor.filter.Metadata Sequence] type: Block id: 'slexAircraftExample:1' checks: [1×1 String Sequence]
Alternatively, you can view the exclusion in the Model Advisor Exclusion Editor by right-clicking the Simulink canvas and selecting Model Advisor > Open Model Advisor Exclusion Editor.
The Model Advisor Exclusion Editor shows a table with a row for the
u
Inport block exclusion. The Filter Identifier column
shows the pathname specified by the entityIdentifier
argument and
the Filter Type column shows the exclusion filter type specified by
filterType
argument. The Rationale and
Check ID(s) columns are associated with the
rationale
and checks
arguments.
Input Arguments
modelName
— Model to get exclusions from
character vector | string array
Model to get exclusions from, specified as a character vector or string array.
Example: Advisor.getExclusion('mymodel');
Data Types: char
| string
filterType
— Type of entity to get exclusions from
Block
| BlockType
| Subsystem
| Library
| MaskType
| ...
Type of entity to get the exclusions from, specified as one of these values.
Value | Description |
---|---|
Block | Simulink block |
BlockType | Blocks with a specific BlockType property
value |
Subsystem | Blocks inside a subsystem |
Library | Instances of a library block |
MaskType | Blocks or subsystems with a specific MaskType
property value |
Stateflow | Stateflow blocks in Simulink |
Chart | Every entity inside Stateflow chart |
State | Stateflow State |
Transition | Stateflow Transition |
Junction | Stateflow Junction |
GraphicalFunction | Stateflow Graphical Function |
MatlabFunction | Stateflow MATLAB Function |
SimulinkFunction | Stateflow Simulink Function |
TruthTable | Stateflow Truth Table |
SimulinkBasedState | Simulink based state in Stateflow |
Example: Advisor.getExclusion('mymodel', 'Block',
'mymodel/Constant')
Data Types: char
| string
entityIdentifier
— Identifier for entity that you want to get exclusions from
BlockType
value | MaskType
value | pathname
Identifier for the entity that you want to get exclusions from, specified as a
BlockType
property value, MaskType
property
value, or pathname.
If you specified the filterType
argument as:
BlockType
, then specify aBlockType
value.You can use the functions
gcb
andget_param
to get the currently selected block and the block type. For example:myblock = gcb; blockType = get_param(myblock,'BlockType'); Advisor.getExclusion('mymodel','BlockType',blockType);
MaskType
, then specify aMaskType
value.You can use the functions
gcb
andget_param
to get the currently selected entity and the mask type. For example:blockWithMask = gcb; maskType = get_param(blockWithMask,'MaskType'); Advisor.getExclusion('mymodel','MaskType',maskType);
Any other
filterType
argument, then specify the pathname for the entity.You can use the function
gcb
to get the pathname for an entity. For example:myblock = gcb; Advisor.getExclusion('mymodel','Block',myblock)
Example: Advisor.getExclusion('mymodel', 'Block',
'mymodel/Constant')
Data Types: char
| string
Output Arguments
exclusionInfo
— Exclusion information
AdvisorFilterSpecification
object | advisor.filter.FilterSpecification
Sequence
Exclusion information, returned as an AdvisorFilterSpecification
object or advisor.filter.FilterSpecification
Sequence
. An advisor.filter.FilterSpecification
Sequence
contains an AdvisorFilterSpecification
object for each exclusion.
Note
If the checks
property in the displayed result is .*, then Model Advisor excludes the entity from
all checks.
Alternative Functionality
Model Advisor Exclusion Editor
You can also view exclusions by using the Model Advisor Exclusion Editor. To view exclusion information for a model, right-click in the Simulink canvas or right-click an entity and select Model Advisor > Open Model Advisor Exclusion Editor. For more information, see Exclude Blocks from Model Advisor Check Analysis.
Version History
Introduced in R2021aR2020a: Use pathname instead of Simulink Identifier (SID)
The function Simulink.ID.getSID
is not recommended. Use the
pathname instead of a Simulink Identifier (SID) when you specify the argument
entityIdentifier
. You can find the pathname by using the gcb
or find_system
functions.
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)