bdroot
Top-level model of current system
Description
returns the top-level
model of the current system. The current system is the currently active Simulink® Editor window or the model in which a block is selected.model
= bdroot
Examples
Get Top-Level Model of Current System
Open the example. Then, in the f14
model, open the subsystem named Controller
.
load_system('f14') open_system('f14/Controller')
Get the top-level model of the current system.
bdroot
ans = 'f14'
Get Top-Level Model of Selected Block
Open the example. Then, open the f14
model.
open_system('f14')
In the model, interactively select a block.
Get the top-level model of the selected block. Use the gcb
function to specify the selected block.
bdroot(gcb)
ans = 'f14'
The function returns a character vector that specifies the name of the top-level model.
You can also specify the block as a handle. Get the handle of the current block.
h1=getSimulinkBlockHandle(gcb)
h1 = 507.0016
Get the top-level model of the selected block.
h2=bdroot(h1)
h2 = 0.0022
The function returns the handle of the top-level model. To get the name of the top-level model, pass the handle of the top-level model to the getfullname
function.
getfullname(h2)
ans = 'f14'
Input Arguments
elements
— Model or model elements whose top-level models to return
handle | numeric array of handles | character vectors | cell array of character vectors | string | string array
Model or model elements whose top-level model to return, specified as a handle, model name, model path or block path. Specify a model name, model path, or block path using character vectors or a string. Specify multiple model names, model paths, or block paths as cell arrays of character vectors or a string array. Specify multiple handles as a numeric array of handles.
Tip
Use bdroot
with gcs
,
gcb
, and gcbh
to get the
top-level model of the current system or block.
Output Arguments
model
— Top-level model
handle | character vector | cell array | string array
Top-level model. If the input argument is a handle, the function returns
the handle of the top-level model. If the input argument is not a handle,
the function returns the name of the top-level model, expressed as a
character vector. If the input was an array, model
is
returned as an array of the same type as the input.
Version History
Introduced before R2006a
Ouvrir l'exemple
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes 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)