slcoverage.Selector Class
Namespace: slcoverage
Get selectors of all types
Description
Use the slcoverage.Selector
class with the
allSelectors
method to return all
types of the selectors for a model object.
The slcoverage.Selector
class is a handle
class.
Properties
ConstructorCode
— Code used to create this selector object
character array
Code used to create this selector object, returned as a character vector.
Attributes:
GetAccess | public |
SetAccess | protected |
Description
— Description of the selector
character vector
Description of the selector, returned as a character vector. Simulink® Coverage™ creates the description based on the selector.
Attributes:
GetAccess | public |
SetAccess | protected |
Id
— Element identifier
Simulink ID (default) | handle
Identifier of the model element, returned as character vector of the Simulink ID or a handle.
Attributes:
GetAccess | public |
SetAccess | protected |
Type
— Selector type
selector type value
Selector type, returned as a selector type of the corresponding selector.
Attributes:
GetAccess | public |
SetAccess | protected |
Methods
Public Methods
allSelectors | Selectors for model or code element |
Examples
Get All Selectors
This example shows how to get all the selectors for an And block and then add a rule to justify or exclude a selector. Metric selectors can only be justified.
Load the model and set coverage settings
modelName = 'slvnvdemo_covfilt'; load_system(modelName); set_param(modelName,'CovEnable','on','CovMetricStructuralLevel','MCDC');
First, get the block handle for the And block.
id = getSimulinkBlockHandle([modelName,'/Saturation']);
Get the selectors using the block handle.
sel = slcoverage.Selector.allSelectors(id)
sel = 1x10 heterogeneous Selector (BlockSelector, MetricSelector) array with properties: Description Type Id ConstructorCode
The block has ten selectors. You can index into each one to see their contents. In this example, you want to justify the sixth selector.
sel(6)
ans = MetricSelector with properties: ObjectiveIndex: 2 OutcomeIndex: 2 Description: 'T outcome of input > upper limit in Saturate block "Saturation"' Type: DecisionOutcome Id: 'slvnvdemo_covfilt:5' ConstructorCode: 'slcoverage.MetricSelector(slcoverage.MetricSelectorType.DecisionOutcome, 'slvnvdemo_covfilt:5', 2, 2)'
Create a justify rule, then create a filter object and add the rule to it.
rule = slcoverage.FilterRule(sel(6),'Expected result');
filt = slcoverage.Filter;
filt.addRule(rule);
Save the filter and generate a coverage report.
filt.save('metrfilter'); csim = cvsim(modelName); csim.filter = 'metrfilter'; cvhtml('cov',csim,'-sRT=0');
Version History
Introduced in R2017b
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)