Documentation Center

  • Trial Software
  • Product Updates

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 string 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 string 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 name of the top-level system that contains the current block.

bdroot (gcbh)

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

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

See Also

| | | |

Was this topic helpful?