Documentation Center

  • Trial Software
  • Product Updates

Limit the Scope of Model Advisor Analysis

What Is a Model Advisor Exclusion?

To save time during model development and verification, you might decide to limit the scope of a Model Advisor analysis of your model. You can do this by excluding individual blocks from checks. You create a Model Advisor exclusion to exclude blocks in the model from selected checks. You can exclude all or selected checks from:

  • Simulink® blocks

  • Stateflow® charts

After you specify the blocks to exclude, when you use the Model Advisor to analyze your model, the software uses the exclusion information to exclude blocks from specified checks during the analysis. A Model Advisor exclusion file stores the block and check exclusion information.

You can also exclude blocks from checks that you write by using Model Advisor APIs. For more information, see Exclude Blocks From Custom Checks.

    Note:   If you Comment Blocks, they are excluded from both simulation and Model Advisor analysis.

Model Advisor Exclusion Files

A Model Advisor exclusion file specifies a collection of blocks to exclude from specified checks during a Model Advisor analysis.

To exclude blocks from specified checks during an analysis of your model, you first create exclusions and save them in an exclusion file. You can also use an existing Model Advisor exclusion file.

When you analyze a model with Model Advisor exclusions, the blocks in the exclusion file are excluded from the specified checks during the analysis. You can use an exclusion file with several models. However, a model can have only one exclusion file.

Unless you specify a different folder, the Model Advisor saves exclusion files in the current folder. The default name for an exclusion file is <model_name>_exclusions.xml.

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.

In the Model Advisor Exclusion Editor dialog box, you can view each exclusion. Each exclusion includes the information listed in the following table.

FieldDescription
Rationale

A description of why this object is excluded from Model Advisor checks.

Type

Whether a specific block is excluded or all blocks of a given type are excluded.

Value

Name of block or blocks that are excluded.

Check ID (s)

Names of checks for which the block exclusion applies.

Create Model Advisor Exclusions

You might want to exclude model blocks and checks from a Model Advisor analysis to save time during model development and verification. To create a Model Advisor exclusion:

  1. In the model window, right-click a block and select Model Advisor. The following table lists the possible menu options. The following table lists what you can exclude and the corresponding menu options.

    To ...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 with 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 with 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 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 after a Model Advisor analysis.

    Exclude all blocks with type <block_type> > Only failed checks

    Exclude the block from a failed check. This option is available 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 after a Model Advisor analysis.

    Exclude all blocks with type <block_type> > <name of failed check>

  2. In the Model Advisor Exclusion Editor dialog box, click OK or Apply to create the exclusion and save the information to an exclusion file. If this exclusion is the first one, a Save Exclusion File as dialog box opens. In this dialog box, click Save to create a exclusion file with the default name <model_name>_exclusions.xml in the current folder. Optionally, in the Save Exclusion File dialog box, you can select a different file name or location.

  3. If you want to change the exclusion file name or location:

    1. In the Model Advisor Exclusion Editor dialog box, select Change.

    2. In the Change Exclusion File dialog box, select Save as.

    3. In the Save Exclusion File dialog box, navigate to the location that you want and enter a file name. Click Save.

    4. In the Model Advisor Exclusion Editor dialog box, select OK or Apply to create the exclusion and save the information to an exclusion file.

You can create as many Model Advisor exclusions as you want by right-clicking model blocks and selecting Model Advisor. Each time that you create an exclusion, the Model Advisor Exclusion Editor dialog box opens. In this dialog box, in the Rationale field, you can specify a reason for excluding blocks or checks from the Model Advisor analysis. The rationale might be useful to others who review your model.

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.

Review Model Advisor Exclusions

You can review the exclusions associated with your model. After opening your model, you might want to view the exclusions defined for your model by an attached exclusion file.

To view exclusions information, either before or after an Model Advisor analysis:

  • 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.

  • On the Model Advisor toolbar, select Settings > 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 model window, select Analysis > Model Advisor > Model Advisor to launch the Model Advisor.

    1. On the Model Advisor window toolbar, select Highlighting > Highlight Exclusions. By default, this menu option is selected.

    2. In the Model Advisor window, click the Enable highlighting toggle button ( ).

    3. In the left pane of the Model Advisor window, select a check. The blocks excluded from the check appear in the model window, highlighted in gray with a black border.

After the Model Advisor completes an analysis, you can view exclusion information for individual checks in the:

  • HTML report. In the Model Advisor window, make sure select the Show report after run check box before the analysis.

  • Model Advisor window. In the left pane of the Model Advisor window, select By Product > Simulink > < name of check >. If the By Product folder is not displayed, select Show By Product Folder from the Settings > Preferences dialog box.

If the check ...The HTML report and Model Advisor window ...
Has no exclusions rules applied. State that no exclusions were applied to this check. This might happen if you exclude a block from a check that passes without an exclusion.
Does not support exclusions.State that the check does not support exclusions. This might happen if you exclude a block from a check that does not support exclusions.
Is excluded from a block.Lists the check exclusion rules.

Manage Exclusions

To open the Model Advisor Exclusion Editor dialog box, either right-click in the model window or right-click a block and select Model Advisor > Open Model Advisor Exclusion Editor.

    Note:   The Rationale field is the only field that you can edit in the Model Advisor Exclusion Editor.

Save Exclusions To a File

To save an exclusion to a file:

  1. In the Model Advisor Exclusion Editor dialog box, click OK or Apply. If this exclusion is the first one, a Save Exclusion File as dialog box opens. In this dialog box, click Save to create an exclusion file with the default name <model_name>_exclusions.xml in the current folder. Optionally, in the Save Exclusion File dialog box, you can select a different file name or location.

  2. If you want to change the exclusion file name or location:

    1. In the Model Advisor Exclusion Editor dialog box, select Change.

    2. In the Change Exclusion File dialog box, select Save as.

    3. In the Save Exclusion File dialog box, navigate to the location that you want and enter a file name. Click Save.

    4. In the Model Advisor Exclusion Editor dialog box, select OK or Apply to create the exclusion and save the information to an exclusion file.

Load an Exclusion File

To load an existing exclusion file for use with your model:

  1. In the Model Advisor Exclusion Editor dialog box, click Change.

  2. In the Change Exclusion File Dialog box, click Load.

  3. Navigate to the exclusion file that you want to use with your model. Select Open.

  4. In the Model Advisor Exclusion Editor dialog box, click OK to associate the exclusion file with your model.

Detach an Exclusion File

To detach an exclusion file associated with your model:

  1. In the Model Advisor Exclusion Editor dialog box, click Change.

  2. In the Change Exclusion File Dialog box, click Detach.

  3. In the Model Advisor Exclusion Editor dialog box, click OK to detach the exclusion file from your model.

Remove an Exclusion

To remove an exclusion:

  1. In the Model Advisor Exclusion Editor dialog box, select the exclusions that you want to remove.

  2. Click Remove Exclusion.

Add a Rational 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 might be useful to others who review your model.

  1. In the Model Advisor Exclusion Editor dialog box, double-click the Rationale field for the exclusion.

  2. Delete the existing text.

  3. Add the rationale for excluding this object.

Was this topic helpful?