bdroot

Top-level model of current system

Syntax

model = bdroot
model = bdroot(elements)

Description

example

model = bdroot returns the top-level model of the current system. The current system is the currently active Simulink® Editor window or the system in which a block is selected.

example

model = bdroot(elements) returns the top-level model of the specified model elements. Before using bdroot, make sure the top-level model of each element in elements is loaded.

Examples

collapse all

Open the system Controller in the model f14.

load_system('f14')
open_system('f14/Controller')

Get the top-level model of the current system.

bdroot
ans =

    'f14'

Open the system Controller in the model f14.

load_system('f14')
open_system('f14/Controller')

Get the top-level model of the current system.

bdroot(gcs)
ans =

    'f14'

Input Arguments

collapse all

Model elements whose top-level model to return, specified as the model name, block or system path name, handle, cell array of character vectors or string array of system names, or 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

collapse all

Top-level model, returned as a character vector of the model name. If the input was an array, model is returned as an array of the same type as the input.

See Also

| |

Introduced before R2006a