Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

bdroot

Return name of top-level Simulink system

Syntax

bdroot
bdroot(obj)
bdroot(handle)
bdroot(sys)

Description

bdroot with no arguments returns the name of the current top-level system.

bdroot(obj), where obj is a character vector specifying a system or block path name, returns the name of the top-level system containing the specified object name. The bdroot of an empty character vector generates an error. Prior to issuing bdroot, make sure that the top-level system is loaded.

bdroot(handle), where handle is the numeric handle for a system or block, returns the numeric handle of the top-level system containing the specified object. Prior to issuing bdroot, make sure that the top-level system for each element in the cell array is loaded. If you specify a vector of handles, Simulink® returns a list of handles of the top-level systems.

bdroot(sys), where sys is a cell array of system names or a vector of system handles. Prior to issuing bdroot, make sure that the top-level system for each element in the cell array is loaded. If you specify a vector of handles, Simulink returns a list of handles of the top-level systems.

Examples

This command returns the name of the top-level system that contains the current block.

bdroot(gcb)

This command returns the name of the top-level system that contains the current system.

bdroot (gcs)

This command returns the numeric handle of the top-level system that contains the current block.

bdroot (gcbh)

If gcbh is a cell array of system names or handles, it returns a cell array containing the corresponding top-level system names or handles.

If gcbh is a numeric array of system handles, it returns a numeric array containing the corresponding top-level system handles.

Introduced before R2006a

Was this topic helpful?