Main Content

slreportgen.finder.ModelVariableResult クラス

パッケージ: slreportgen.finder
スーパークラス: mlreportgen.finder.Result

モデル変数の検索結果オブジェクト

R2019b 以降

説明

Simulink® モデルまたはサブシステムで使用されているモデル変数の検索結果オブジェクト。

slreportgen.finder.ModelVariableResult クラスは handle クラスです。

クラス属性

HandleCompatible
true

クラス属性の詳細については、クラスの属性を参照してください。

作成

slreportgen.finder.ModelVariableResult オブジェクトは、明示的に作成しません。slreportgen.finder.ModelVariableFinderfind または next メソッドは、検出した変数ごとに slreportgen.finder.ModelVariableResult オブジェクトを作成します。

プロパティ

すべて展開する

この結果によって表される変数の Simulink.VariableUsage オブジェクト。このプロパティは読み取り専用です。

この結果によって表される変数の名前。文字ベクトルとして指定します。このプロパティは読み取り専用です。

変数定義のソース。文字ベクトルとして指定します。このプロパティは読み取り専用です。次の表は、値の例を示しています。

説明
'base workspace'MATLAB® ベース ワークスペース
'MyModel'MyModel のモデル ワークスペース
'MyModel/Mask1' マスク ブロックのマスク ワークスペース
'my_data_dictionary.sldd'

データ ディクショナリ my_data_dictionary.sldd

変数を定義するワークスペースのタイプ。次のいずれかの文字ベクトルで指定します。

  • 'base workspace'

  • 'model workspace'

  • 'mask workspace'

  • 'data dictionary'

このプロパティは読み取り専用です。

変数を使用するブロック。文字ベクトルの cell 配列で指定します。このプロパティは読み取り専用です。

変数値を設定する Model ブロックのパス。文字ベクトルとして指定します。このプロパティは読み取り専用です。

参照モデルがモデル引数を使用してブロック パラメーター値を設定するとします。モデルに参照モデルの複数のインスタンスがある場合、モデル変数ファインダーは、モデル引数に関連付けられている変数の複数のインスタンスを返します。ModelBlockPath プロパティは、その値を設定する Model ブロックへのパスを提供することにより、変数のインスタンスを一意に特定します。変数が参照モデル内のモデル引数に関連付けられていない場合、ModelBlockPath は空です。参照モデルとインスタンス固有のパラメーターの詳細については、再利用可能な参照モデルのインスタンスのパラメーター化を参照してください。

この結果と共に保存する追加情報。任意の型の値に設定できます。

メソッド

すべて展開する

すべて折りたたむ

検索結果を反復処理し、結果ごとにモデル変数レポーターのプロパティを設定することで、レポートにおけるモデル変数の書式設定をカスタマイズします。

% Create a Report
rpt = slreportgen.report.Report("MyReport","pdf");

% Create a Chapter
chapter = mlreportgen.report.Chapter();
chapter.Title = "Model Variable Reporter Example";

% Load the model
model_name = "slrgex_sf_car";
load_system(model_name);

% Find the variables in the model
finder = slreportgen.finder.ModelVariableFinder(model_name);

while hasNext(finder)
    result = next(finder);
    
    % Get the ModelVariable reporter for the result
    % Customize the formatting of numbers
    reporter = getReporter(result);
    reporter.NumericFormat = "%.4f";
    
    % Add the reporter to the chapter
    add(chapter,reporter);
end
% Add chapter to the report
add(rpt,chapter);

% Close the report and open the viewer
close(rpt);
rptview(rpt);

バージョン履歴

R2019b で導入