メインコンテンツ

slreportgen.report.Annotation クラス

名前空間: slreportgen.report
スーパークラス: slreportgen.report.Reporter

Simulink 注釈に関するレポート

R2022b 以降

説明

クラス slreportgen.report.Annotation のオブジェクトを使用して、Simulink.Annotation オブジェクトについてレポートします。

slreportgen.report.Annotation クラスは handle クラスです。

クラス属性

HandleCompatible
true

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

作成

説明

rptr = slreportgen.report.Annotation は、既定のテンプレートに基づいて空の Annotation レポーターを作成します。レポーターをレポートに追加する前に、Object プロパティを設定します。

rptr = slreportgen.report.Annotation(annotationObj) は、Annotation レポーターを作成し、Object プロパティを annotationObj に設定します。

rptr = slreportgen.report.Annotation(Name1=Value1,...,NameN=ValueN) は、Annotation レポーターを作成し、名前と値の引数を使用してプロパティを設定します。複数の名前と値の引数を任意の順序で指定できます。

メモ

slreportgen.report.Annotation レポーターは、単一イメージの注釈と注釈内の数式についてレポートすることはできません。

プロパティ

すべて展開する

レポートする注釈。slreportgen.finder.AnnotationFinder ファインダーまたは slreportgen.finder.DiagramElementFinder ファインダーによって検索された Simulink.Annotation ハンドルまたは検索結果オブジェクトとして指定されます。

Simulink.Annotation オブジェクトへのハンドルを取得するには、find_system 関数を使用します。次に例を示します。

load_system(model_name);
handleArray = find_system(model_name,findall=true,type="annotation");

属性:

GetAccess
public
SetAccess
public

このレポーターのテンプレートのソース。以下のいずれかの方法で指定します。

  • このレポーターのテンプレートを含むファイルのパスを指定する、文字ベクトルまたは string スカラー

  • このレポーターが使用するテンプレートをもつか、このレポーター用のテンプレートを含むテンプレート ライブラリをもつ、レポーターまたはレポート

  • このレポーターが使用するテンプレートをもつか、このレポーター用のテンプレートを含むテンプレート ライブラリをもつ、ドキュメント オブジェクト モデル (DOM) のドキュメントまたはドキュメント パーツ

指定されるテンプレートは、このレポートが追加されるレポーターと同じタイプでなければなりません。たとえば、Microsoft® Word レポートの場合、TemplateSrc は Word レポーター テンプレートでなければなりません。TemplateSrc プロパティが空の場合、このレポーターはレポートの出力タイプで既定のレポーター テンプレートを使用します。

属性:

GetAccess
public
SetAccess
public
NonCopyable
true

このレポーター テンプレートの名前。文字ベクトルまたは string スカラーとして指定します。このレポーター テンプレートは、このレポーターの TemplateSrc プロパティで指定されたテンプレートのテンプレート ライブラリになければなりません。

属性:

GetAccess
public
SetAccess
public

データ型: char | string

このレポーターのハイパーリンク ターゲット。リンク ターゲット ID を指定する文字ベクトルまたは string スカラー、あるいは mlreportgen.dom.LinkTarget オブジェクトとして指定します。文字ベクトルまたは string スカラーの値は LinkTarget オブジェクトに変換されます。リンク ターゲットは、出力レポートでこのレポーターのコンテンツの直前に配置されます。

属性:

GetAccess
public
SetAccess
public

メソッド

すべて展開する

すべて折りたたむ

この例では、Simulink 注釈についてレポートする方法を説明します。

長い完全修飾クラス名を使用せずに済むよう、次のパッケージをインポートします。

import slreportgen.finder.*
import slreportgen.report.*
import mlreportgen.report.*

PDF タイプのレポートを作成します。

rpt = Report("AnnotationReport","pdf");

モデルを開きます。次に、slreportgen.finder.AnnotationFinder オブジェクトを作成して、モデルで Simulink.Annotation 要素を検索します。

model_name = "annotationReporterExampleModel";
open_system(model_name);
annotationFinder = AnnotationFinder(model_name);

ファインダーを使用して、モデル内の注釈要素を検索します。次に、モデル内で検索された注釈に対して使用する mlreportgen.report.Chapter オブジェクトを作成します。

annotationResults = find(annotationFinder);
annotationChapter = Chapter("Annotations");

結果を反復し、それぞれに対して Annotation レポーターを作成して、そのレポーターを章に追加します。

for idx = 1:length(annotationResults)
  annotationReporter = Annotation(annotationResults(idx));
  append(annotationChapter,annotationReporter);
end

章をレポートに追加します。

append(rpt,annotationChapter);

レポートとモデルを閉じ、レポートを表示します。

close(rpt);
close_system(model_name);
rptview(rpt);

バージョン履歴

R2022b で導入