getBlock
Get single block path in model reference hierarchy
Description
Examples
Get Block Path for Specified Model Hierarchy Level
Open the example model, which references multiple models.
sldemo_mdlref_depgraph
Create a Simulink.BlockPath
object.
bp = Simulink.BlockPath({'sldemo_mdlref_depgraph/thermostat', ... 'sldemo_mdlref_heater/Fahrenheit to Celsius', ... 'sldemo_mdlref_F2C/Gain1'});
Get the block for the second level in the model reference hierarchy.
blockpath = getBlock(bp,2)
blockpath = 'sldemo_mdlref_heater/Fahrenheit to Celsius'
Get the block for the third level in the model reference hierarchy.
blockpath = getBlock(bp,3)
blockpath = 'sldemo_mdlref_F2C/Gain1'
Input Arguments
bp
— Fully specified block path
Simulink.BlockPath
object
Fully specified block path, specified as a Simulink.BlockPath
object. This block path uniquely identifies a block within a model hierarchy, even when
the model hierarchy references the same model multiple times.
index
— Index of block
integer
Index of the block for which you want to get the block path, specified as an integer. The index reflects the level in the model reference hierarchy. For example:
An index of
1
represents a block in the top model.An index of
2
represents a block in the model that is referenced by the Model block of index1
.An index of
n
represents a block in the model that is referenced by the Model block of indexn-1
.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Output Arguments
block
— Block path of block
character vector
Block path of the block at the level of the model reference hierarchy specified by
the index
argument, returned as a character vector.
Version History
Introduced in R2010b
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 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)