getLength
ブロック パスの階層レベル数の取得
説明
例
ブロック パスの階層レベル数の取得
ModelReferenceHierarchy
という名前のプロジェクトを開きます。
openProject("ModelReferenceHierarchy");
プロジェクトで sldemo_mdlref_depgraph
を最上位モデルとしたモデルの階層構造が開きます。
モデルの階層構造内のブロックを表す Simulink.BlockPath
オブジェクトを作成します。
bp = Simulink.BlockPath(... {'sldemo_mdlref_depgraph/thermostat',... 'sldemo_mdlref_heater/Fahrenheit to Celsius'});
Simulink.BlockPath
オブジェクトのブロック パス内の階層レベル数を取得します。
length = getLength(bp)
length = 2
入力引数
bp
— 完全に指定されたブロック パス
Simulink.BlockPath
オブジェクト | Simulink.SimulationData.BlockPath
オブジェクト
完全に指定されたブロック パス。Simulink.BlockPath
オブジェクトまたは Simulink.SimulationData.BlockPath
オブジェクトとして指定します。このブロック パスは、モデルの階層構造が同じモデルを複数回参照する場合でも、モデルの階層構造内のブロックを一意に特定します。
出力引数
length
— ブロック パスの長さ
整数
ブロック パスの長さ。整数として返されます。この長さは、モデル参照階層のレベル数です。
バージョン履歴
R2010b で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは 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)