You can programmatically add a filter for a MATLAB function by creating a selector with the following command:
>> selector = slcoverage.BlockSelector(slcoverage.BlockSelectorType.BlockInstance, <matlab function name here>);
You can then use this selector to create a filter rule as follows:
>> filter = slcoverage.Filter;
>> filterRule = slcoverage.FilterRule(selector, 'Exclude from coverage', slcoverage.FilterMode.Exclude);
>> filt.addRule(rule);
Please also note that you can get all selectors associated with a MATLAB function by executing the following command after simulating the model for coverage:
>> selectors = slcoverage.Selector.allSelectors(<matlab function name here>);
More information on this command can be found here:
Best Answer