Exclude Blocks From the Model Advisor Check Analysis
Model Advisor Exclusion Overview
To save time during model development and verification, you can limit the scope of the Model Advisor analysis of your model. You can create a Model Advisor exclusion to exclude blocks in the model from selected checks. You can exclude all or selected checks from:
After you specify the blocks to exclude, Model Advisor uses the exclusion information to exclude blocks from specified checks during analysis. By default, Model Advisor exclusion information is stored in the model SLX file. Alternatively, you can store the information in an exclusion file.
To view exclusion information for the model, right-click in the model window or right-click a block and select Model Advisor > Open Model Advisor Exclusion Editor.
The Model Advisor Exclusion Editor dialog box includes the following information for each exclusion.
Name and path of the block or subsystem that is excluded. The path of the blocks are hyper-linked and clicking on them will highlight the concerned blocks on the model canvas.
Defines the type of the excluded item.
Example: If the filter type is Block, on that particular Simulink block is excluded. If the type is Subsystem, then all the contents inside that subsystem are excluded.
Editable field to enter notes or the reason for exclusion. By default, this field defines whether a specific block is excluded or all blocks of a given type are excluded.
|Check ID (s)|
Names of the checks for which the block exclusion applies. Check Selector can be invoked from this cell by clicking on the edit () button.
If you comment out blocks, they are excluded from both simulation and Model Advisor analysis.
Filter type defines the type of the excluded entity. Model Advisor Exclusion Editor currently supports exclusion of the following entities:
|Block||Exclude a Simulink block.|
|BlockType||Exclude all blocks of a type.|
|Subsystem||Exclude all blocks inside a Subsystem.|
|Library||Exclude all instances of a Library block.|
|MaskType||Exclude blocks or subsystem of mask type.|
|Stateflow||Exclude Stateflow blocks in Simulink.|
|Chart||Exclude every entity inside a Stateflow Chart.|
|State||Exclude a Stateflow State.|
|Transition||Exclude a Stateflow Transition.|
|Junction||Exclude a Stateflow Junction.|
|GraphicalFunction||Exclude a Stateflow Graphical Function.|
|MATLABFunction||Exclude a Stateflow MATLAB Function.|
|SimulinkFunction||Exclude a Stateflow Simulink Function.|
|TruthTable||Exclude a Stateflow Truth Table.|
|SimulinkBasedState||Exclude a Stateflow Simulink based state.|
Create Model Advisor Exclusions
In the model window, right-click a block and select Model Advisor. Select the menu option for the type of exclusion that you want to do.
Task Select Model Advisor > Exclude the block from all checks.
Exclude block only > All Checks
Exclude all blocks of this type from all checks.
Exclude all blocks of type <block_type> > All Checks
Exclude the block from selected checks.
Exclude block only > Select Checks.
In the Check Selector dialog box, select the checks. Click OK.
Exclude all blocks of this type from selected checks.
Exclude all blocks of type <block_type> > Select Checks.
In the Check Selector dialog box, select the checks. Click OK.
Exclude the block from all failed checks. This option is available only after a Model Advisor analysis.
Exclude block only > Only failed checks
Exclude all blocks of this type from all failed checks. This option is available only after a Model Advisor analysis.
Exclude all blocks of type <block_type> > Only failed checks
Exclude the block from a failed check. This option is available only after a Model Advisor analysis.
Exclude block only > <name of failed check>
Exclude all blocks of this type from a failed check. This option is available only after a Model Advisor analysis.
Exclude all blocks of type <block_type> > <name of failed check>
In the Model Advisor Exclusion Editor dialog box, save the exclusions to the model or an exclusion file by using one of the processes below.
You can create as many Model Advisor exclusions as you want by right-clicking model blocks and selecting the options under Model Advisor.
Save Model Advisor Exclusions in a Model File
To save Model Advisor exclusions to the model
.slx file, in the
Model Advisor Exclusion Editor dialog box, click on the save
icon(). When you open the model
file, the model contains the exclusions.
Save Model Advisor Exclusions in Exclusion File
A Model Advisor exclusion file specifies the collection of blocks to exclude from specified checks in an exclusion file. You can create exclusions and save them in an exclusion file.
To save Model Advisor exclusions to the exclusion
Open the Model Advisor Exclusion Editor.
click the drop-down next to the save icon().
Select Save as and enter the desired name for the exclusion file in the File name field.
Unless you specify a different folder, the Model Advisor saves exclusion files in the current folder.
If you create an exclusion file and save your model, you attach the exclusion file to your model. Each time that you open the model, the blocks and checks specified in the exclusion file are excluded from the analysis.
The Check Selector window allows you to select the checks to exclude for a specific block or all blocks of a specified type. Open the Check Selector by right-clicking a block and selecting either:
Model Advisor > Exclude block only > Select checks
Model Advisor > Exclude all blocks of type <block_type> > Select checks
In the Check Selector, you can use the search functionality to search for a check that needs to be excluded. Check Selector can be also invoked from the Model Advisor Exclusion Editor window by clicking on the edit () button in the Check Id(s) column.
Review Model Advisor Exclusions
You can review the exclusions associated with your model. Before or after a Model Advisor analysis, to view exclusions information:
Right-click in the model window or right-click a block and select Model Advisor > Open Model Advisor Exclusion Editor. The Model Advisor Exclusion Editor dialog box lists the exclusions for your model.
In the Modeling tab, open Model Advisor > Preferences. In the Model Advisor Preferences dialog box, select Show Exclusion tab. In the right pane of the Model Advisor window, select the Exclusions tab to display checks that are excluded from the Model Advisor analysis.
In the Modeling tab, select Model Advisor to open the Model Advisor.
On the Model Advisor window toolbar, select Highlighting > Highlight Exclusions. By default, this menu option is selected.
In the Model Advisor window, click Enable highlighting ().
After the Model Advisor analysis, you can view exclusion information for individual checks in the:
HTML report. Before the analysis, in the Model Advisor window, make sure that you select the Show report after run check box.
After you run the checks, in the left pane of the Model Advisor window, the checks that contain exclusion rules are highlighted in orange. The Model Advisor results include additional information about the exclusion.
If the check The HTML report and Model Advisor window Has no exclusions rules applied. Show that no exclusions were applied to this check. Does not support exclusions. Shows that the check does not support exclusions. Is excluded from a block. Lists the check exclusion rules.
Load an Exclusion File
To load an existing exclusion file for use with your model:
In the Model Advisor Exclusion Editor dialog box, click Load icon.
Navigate to the exclusion file that you want to use with your model. Select Open.
In the Model Advisor Exclusion Editor dialog box, click OK to associate the exclusion file with your model.
Remove an Exclusion
In the Model Advisor Exclusion Editor dialog box, select the exclusions that you want to remove.
Click the Delete Exclusion Row button ().
Add Summary to an Exclusion
You can add text that describes why you excluded a particular block or blocks from selected checks during Model Advisor analysis. A description is useful to others who review your model.
In the Model Advisor Exclusion Editor dialog box, double-click the Summary field for the exclusion.
Delete the existing text.
Add the summary for excluding this object.
Compatibility Considerations after R2020b
In R2020b, the format in which exclusions are stored changed. In releases after R2020b, Model Advisor can read format used in previous releases, and convert it to new format. Conversion happens only once. The model is updated with the new file path, which Exclusion editor subsequently uses.
When you open a exclusion file created in R2020a or earlier, the files and models are updated based on whether the exclusion file was saved in the model or as a separate file, following are the sequence of actions that will be performed in each case:
Exclusion File Saved Inside the Model
The original exclusion file is read and written to a new file.
The new file is saved in the model SLX file when you save the model.
These changes are done automatically, and without notification that the file has been updated.
Exclusion File Is Saved in a Separate Exclusion File
The old file is read and, you can choose to overwrite the existing exclusion file or save the exclusion file with a new name in the same location.
The model updates the new file path when you save the model.
The Exclusion Editor reports that a change has taken place.
Programmatically Change Model Advisor Exclusions
The Model Advisor Exclusion Editor can now be used with the following functions:
|Add a new exclusion in Model Advisor.|
|Remove exclusions from Model Advisor.|
|Clear all exclusions from Model Advisor.|
|Get exclusions for a model or a filter.|
|Save exclusions to the default option or to a new file.|
|Load default exclusions stored inside the model or according to the path settings.|
The Model Advisor Exclusion file path is tracked by a model parameter called
MAModelFilterFile. Use the
API to update this parameter.
After the model is saved and reopened, the changes are reflected in the Exclusion
<new_file_path> is an empty character vector, Model
Advisor Exclusion Editor assumes the file is stored inside the model SLX file.
- Exclude Blocks From Custom Checks
- Run Model Advisor Checks and Review Results
- Address Model Check Results
- Generate Model Advisor Reports
- Save and View Model Advisor Check Reports
- Find Model Advisor Check IDs
- Archive and View Results
- Limit Model Checks by Excluding Gain and Outport Blocks
- Exclude Blocks from Edit Time Checking