User`s guide

Exclude Blocks From Custom Checks
25-49
Exclude Blocks From Custom Checks
This example shows how to exclude blocks from custom checks. To save time
during model development and verification, you might decide to exclude individual
blocks from custom checks in a Model Advisor analysis. By modifying the
sl_customization.m file to include the ModelAdvisor.Check.supportExclusion
and Simulink.ModelAdvisor.filterResultWithExclusion functions, you can exclude
your custom checks from:
Simulink blocks
Stateflow charts
This example shows how to exclude blocks from a custom check.
1
At the command prompt, type slvnvdemo_mdladv.
2
In the model window, double-click View demo sl_customization.m.
3
To exclude the custom check Check Simulink block font from blocks during Model
Advisor analysis, make three modifications to the sl_customization.m file.
a
Enable the Check Simulink block font check to support check
exclusions by using the ModelAdvisor.Check.supportExclusion
property. You can now exclude the check from model blocks.
After rec.setInputParametersLayoutGrid([3 2]);, add
rec.supportExclusion = true;. The check 1 section of the function
defineModelAdvisorChecks now looks like:
% --- sample check 1
rec = ModelAdvisor.Check('com.mathworks.sample.Check1');
rec.Title = 'Check Simulink block font';
rec.TitleTips = 'Example style three callback';
rec.setCallbackFcn(@SampleStyleThreeCallback,'None','StyleThree');
rec.setInputParametersLayoutGrid([3 2]);
rec.supportExclusion = true;
b
Use the Simulink.ModelAdvisor.filterResultWithExclusion function
to filter model objects causing a check warning or failure with checks
that have exclusions enabled. To do this, there are two locations in the
sl_customization.m file to modify, both in the [ResultDescription,
ResultDetails] = SampleStyleThreeCallback(system) function: