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?

 채택된 답변

Sebastian Castro
Sebastian Castro 2015년 2월 6일

1 개 추천

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