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

1 件のコメント

Jonatan Tingström
Jonatan Tingström 2015 年 2 月 9 日
This will do it! Thanks Sebastian!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCollect Coverage for Models についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by