MATLAB ヘルプ センター
名前空間: slreportgen.finder スーパークラス: mlreportgen.finder.Finder
mlreportgen.finder.Finder
Simulink ブロック内の MATLAB 関数参照の検索
R2022a 以降
クラス slreportgen.finder.FunctionReferenceFinder のオブジェクトを使用して、特に Simulink® ブロック内のパラメーターの計算に使用される関数参照を検索します。
slreportgen.finder.FunctionReferenceFinder
slreportgen.finder.FunctionReferenceFinder クラスは handle クラスです。
handle
HandleCompatible
true
クラス属性の詳細については、クラスの属性を参照してください。
funcRefFinder = slreportgen.finder.FunctionReferenceFinder(container) は、FunctionReferenceFinder オブジェクトを作成し、Container プロパティを container に設定します。
funcRefFinder = slreportgen.finder.FunctionReferenceFinder(container)
funcRefFinder
container
FunctionReferenceFinder
theReporter = slreportgen.finder.FunctionReferenceFinder(Name=Value) は、1 つ以上の名前と値の引数を使用してプロパティを設定します。
theReporter = slreportgen.finder.FunctionReferenceFinder(Name=Value)
theReporter
Name=Value
例
すべて展開する
Container
slreportgen.finder.DiagramResult
slreportgen.finder.BlockResult
関数参照を検索する Simulink モデルまたはブロック。次の値のいずれかとして指定します。
"sf_car"
"sf_car/Engine"
slreportgen.utils.getModelHandle
slreportgen.utils.getModelHandle("sf_car")
getSimulinkBlockHandle
getSimulinkBlockHandle("sf_car/Engine")
GetAccess
public
SetAccess
SearchDepth
Inf
コンテナー内を検索するレベルの数。非負の整数または Inf (検索する深さを無制限にする場合) として指定します。
データ型: double
double
FunctionType
"all"
"built-in"
"user-defined"
検索する関数のタイプ。次の値のいずれかとして指定します。
データ型: string | char
string
char
SearchReferencedModels
1
false
0
参照モデル内を検索するかどうか。数値または logical の 1 (true) または 0 (false) として指定します。Container プロパティによって表されるモデルまたはブロックが参照するモデル内を検索することができます。SearchReferencedModels が true の場合、次のようになります。
ファインダーは、検索の深さ内にある参照モデルのみを検索します。
ファインダーは、参照モデルを含むブロックの深さに関係なく、SearchDepth で指定された深さまで参照モデルを検索します。
ファインダーは、参照モデルが参照するモデルを検索します。
メモ
"off" と "on" を使用して SearchReferencedModels プロパティを設定することもできます。
"off"
"on"
データ型: logical
logical
LookUnderMasks
マスク サブシステム内を検索するかどうか。次のいずれかの値として指定します。
FollowLibraryLinks
ライブラリ リンクをたどるかどうか。次のいずれかの値として指定します。
IncludeInactiveVariants
バリアント サブシステムおよびモデル バリアント内の非アクティブなバリアントが参照する関数を検索するかどうか。logical 1 (true) または 0 (false) として指定します。
Properties
検索対象とする関数のプロパティ。{"Name","Value"} の形式で、名前と値の引数の cell 配列として指定します。ファインダーは、指定のプロパティが指定の値をもつ関数のみを返します。サポートされるプロパティには、slreportgen.finder.FunctionReferenceResult クラスのプロパティが含まれます。
{"Name","Value"}
slreportgen.finder.FunctionReferenceResult
データ型: cell
cell
find
funcRefResArr = find(funcRefFinder) は、FunctionReferenceFinder オブジェクトで指定された制約に一致する関数参照を、slreportgen.finder.FunctionReferenceResult オブジェクトの配列として返します。
funcRefResArr = find(funcRefFinder)
funcRefResArr
hasNext
tf = hasNext(funcRefFinder) は、next メソッドで取得できる結果がある場合は logical 1 (true) を返します。使用可能な結果がない場合、hasNext は logical 0 (false) を返します。
tf = hasNext(funcRefFinder)
tf
next
funcRefRes = next(funcRefFinder) は、次に使用可能な結果を FunctionReferenceResult オブジェクトとして返します。funcRefFinder の制約に一致し、next メソッドでまだ取得されていない場合、結果は使用可能です。使用可能な結果がない場合、next メソッドは空の FunctionReferenceResult オブジェクトを返します。
funcRefRes = next(funcRefFinder)
funcRefRes
FunctionReferenceResult
すべて折りたたむ
この例では次を使用します。
この例では、Simulink ブロック内の MATLAB 関数参照を検索してレポートする方法を説明します。
長い完全修飾クラス名を使用せずに済むよう、次の名前空間をインポートします。
import slreportgen.report.* import slreportgen.finder.*
PDF タイプの slreportgen.report.Report を作成します。
slreportgen.report.Report
theReport = Report("FunctionReferenceReport","pdf");
モデル sldemo_fuelsys を開き、ファインダーが最新バージョンのモデルを検索するようにモデルをコンパイルします。
sldemo_fuelsys
modelName = "sldemo_fuelsys"; open_system(modelName); slreportgen.utils.compileModel(modelName);
slreportgen.finder.FunctionReferenceFinder オブジェクトを作成します。
funcRefFinder = FunctionReferenceFinder(modelName);
参照モデル内を検索するようにファインダーを設定します。
funcRefFinder.SearchReferencedModels = true;
メソッド hasNext および next を使用し、slreportgen.finder.FunctionReferenceResult オブジェクトを一度に 1 つずつ取得します。
while(hasNext(funcRefFinder)) nextRes = next(funcRefFinder);
参照関数が組み込み関数の場合は、結果をレポートに直接追加します。
if(nextRes.FunctionType == "built-in") append(theReport,nextRes);
参照されている関数がユーザー定義関数の場合は、この結果の slreportgen.report.FunctionReference レポーターのハンドルを取得します。レポーターの ShowReferencesTable プロパティを false に設定することで、参照テーブルを除外するようにレポーターをカスタマイズします。次に、レポーターをレポートに追加します。
slreportgen.report.FunctionReference
ShowReferencesTable
else reporter = getReporter(nextRes); reporter.ShowReferencesTable = false; append(theReport,reporter); end end
モデルのコンパイルを解除して閉じます。
slreportgen.utils.uncompileModel(modelName) close_system(modelName);
レポートを閉じて表示します。
close(theReport); rptview(theReport);
R2022a で導入
slreportgen.report.FunctionReference | slreportgen.finder.FunctionReferenceResult | slreportgen.finder.BlockResult | slreportgen.finder.DiagramResult | slreportgen.utils.getModelHandle | getSimulinkBlockHandle
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 のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
ヨーロッパ
アジア太平洋地域
最寄りの営業オフィスへのお問い合わせ