Script based coverage filter creation

I am trying to find a way to create coverage filters using command line or scripts. All I can find in the matlab help documentation are sections describing how to use different guis for adding, creating and setting coverage filters ( http://se.mathworks.com/help/slvnv/ug/create-edit-and-view-coverage-filter-rules.html ). But I need to do these actions using a scripts. For example if I want to exclude a certain subsystem from the coverage report I want to be able to do this using a command line function (e g ExcludeFromCoverage('ModelName/SubSystemName'); ).
Is it only possible to use model coverage filters through the GUIs Coverage Setting and Coverage Filter viewer?

 采纳的回答

Hi Jonatan,
I found an example of this by searching around, but this doesn't seem to be documented. Hopefully this at least helps to get you started with a shipping example, although you may have to play around with the code to figure out how to tailor this for your model.
model = 'slvnvdemo_cv_small_controller';
open_system(model)
ssid = Simulink.ID.getSID('slvnvdemo_cv_small_controller/Saturation')
f = SlCov.FilterEditor.getInstance(model)
props = f.getProperties(ssid)
f.setFilterByProp(props(2),'turn on filter for this block') % the second argument is the description for the filter
f.save('filename')
set_param(model,'CovFilter','filename')
data = cvsim(model)
The other thing is: If you have an existing coverage filter file, you can add it programmatically to a cvtest object using the filter.fileName property. This is listed in the cvtest documentation .
- Sebastian

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Collect Coverage for Models 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by