To create a coverage filter rule:
In the Coverage Settings dialog box, enable model coverage.
In the model window, right-click a model object and select Coverage > Exclude.
The following table lists the Exclude menu options. Depending on which option you select, the Type field is automatically set for the coverage filter rule you selected; you cannot override the value in the Type field.
|If you select Coverage > ...||The rule type is ...|
Exclude this block
Exclude all blocks with type <block_type>
Exclude all blocks with type MATLAB Function
Exclude all blocks with type Truth Table
Exclude subsystem with all dependents
Exclude referenced library: <library_name>
Exclude subsystem with all descendants
Exclude chart with all descendants
Exclude mask type <mask name>
Exclude state with all descendants
Exclude this transition
Exclude temporal event <event_name>
Optionally, you can add text that describes why you want to exclude that object or objects from coverage recording, and might be useful to others who review the coverage for your model. When you add a new coverage filter rule, the Coverage Filter Viewer opens. To add the rationale:
Double-click the Rationale field for the rule.
Delete the existing text.
Add the rationale for excluding this object.
The following graphic shows examples of text in the Rationale field.
Note: The Rationale field is the only coverage filter rule field that you can edit in the Coverage Filter Viewer.
From the Coverage Filter Viewer, you can navigate back to the model to create as many coverage filter rules as you need. To return to the model window, click Add new rule by right-clicking in the model.
For each rule that you add, the Coverage Filter Viewer opens so that you can specify a rationale for excluding that object from coverage.
After you define the coverage filter rules, save the rules to
a file so that you can reuse them with this model or with other models.
By default, coverage filter files are named
In the Coverage Filter Viewer:
In the File name field, specify a file name for the filter file or accept the default file name.
Click Apply to save the coverage filter rules to that file.
If you make multiple changes to the coverage filter rules, apply the changes to the coverage filter file each time.
Attach a coverage filter file to your model so that each time you open the model, the coverage filter rules apply when you simulate your model.
In the Coverage Filter Viewer:
Select Attach file to model.
Note: You can also attach a coverage filter file to your model in the Coverage Settings dialog box, on the Filter tab.
You can have only one coverage filter file attached to a model at a time. If you attach a different coverage filter file, the newly attached file replaces the previously attached file.
Two or more models can have the same coverage filter file attached. If a model has an attached filter file that contains coverage filter rules for specific objects in a different model, those rules are ignored during coverage recording.
Whenever you define a coverage filter rule or remove an existing coverage filter rule, the Coverage Filter Viewer opens. This dialog box lists all the coverage filter rules for your model. For more information, see Coverage Filter Viewer.
To open the Coverage Filter Viewer, right-click anywhere in the model window and select Coverage > Open Filter Viewer.
If you are inside a subsystem, you can view any coverage filter rule attached to the subsystem. To open the Coverage Filter Viewer, right-click any object inside the subsystem and select Coverage > Show filter parent.
To remove a model object from coverage filtering, in the Simulink® Editor, right-click the object and select Coverage > Remove. The Coverage Filter Viewer opens. The coverage filter rule for the selected model object is no longer on the list of rules.
Use the Coverage Filter Viewer to remove multiple coverage filter rules at once:
To open the Coverage Filter Viewer, right-click anywhere in the model and select Coverage > Open Filter Viewer.
Select all the rules that you want to remove.
Click Remove rule.