slcoverage.Selector クラス
名前空間: slcoverage
すべてのタイプのセレクターの取得
説明
slcoverage.Selector クラスの allSelectors メソッドを使用して、モデル オブジェクトに対するすべてのタイプのセレクターを返します。
slcoverage.Selector クラスは handle クラスです。
プロパティ
このセレクター オブジェクトを作成するために使用するコード。文字ベクトルとして返されます。
属性:
GetAccess | public |
SetAccess | protected |
セレクターの説明。文字ベクトルとして返されます。Simulink® Coverage™ は、セレクターに基づいて説明を作成します。
属性:
GetAccess | public |
SetAccess | protected |
モデル要素の識別子。Simulink ID またはハンドルの文字ベクトルとして返されます。
属性:
GetAccess | public |
SetAccess | protected |
セレクター タイプ。対応するセレクターのセレクター タイプとして返されます。
属性:
GetAccess | public |
SetAccess | protected |
メソッド
allSelectors | Selectors for model or code element |
例
この例では、And ブロックに対するすべてのセレクターを取得してから、セレクターを正当化または排除する規則を追加する方法を説明します。メトリクス セレクターは正当化のみ可能です。
モデルを読み込んで、カバレッジを設定します。
modelName = 'slvnvdemo_covfilt'; load_system(modelName); set_param(modelName,'CovEnable','on','CovMetricStructuralLevel','MCDC');
まず、And ブロックのブロック ハンドルを取得します。
id = getSimulinkBlockHandle([modelName,'/Saturation']);
ブロック ハンドルを使用してセレクターを取得します。
sel = slcoverage.Selector.allSelectors(id)
sel =
1×10 heterogeneous Selector (BlockSelector, MetricSelector) array with properties:
Description
Type
Id
ConstructorCode
ブロックには 10 個のセレクターがあります。それぞれにインデックスを付けて、それらの内容を確認できます。この例では、6 個目のセレクターを正当化します。
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)'
正当化する規則を作成し、フィルター オブジェクトを作成して、それに規則を追加します。
rule = slcoverage.FilterRule(sel(6),'Expected result');
filt = slcoverage.Filter;
filt.addRule(rule);
フィルターを保存して、カバレッジ レポートを生成します。
filt.save('metrfilter'); csim = cvsim(modelName); csim.filter = 'metrfilter'; cvhtml('cov',csim,'-sRT=0');
バージョン履歴
R2017b で導入
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- 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)