Main Content

gcb

Get path name of current block

Description

example

bl = gcb returns the full block path name of the current block in the current system. The current block is:

  • The most recently clicked block

  • The S-Function block currently executing its corresponding MATLAB® function

  • The block whose callback routine is being executed

  • The block whose mask is being evaluated as part of the MaskInitialization parameter evaluation

  • The last block loaded after opening a model

example

bl = gcb(sys) returns the full block path name of the current block in the specified system. Load the system first.

Examples

collapse all

Open a model.

vdp

In the model, select a block. For example, select the Gain block. Then, enter gcb at the command prompt.

gcb
ans =

vdp/Mu

Open a model.

vdp

Select the Gain block.

Use the value of gcb with get_param to get the value of the Gain parameter.

x = get_param(gcb,'Gain')
x =

1

Load the Model a Fault-Tolerant Fuel Control System example model sldemo_fuelsys.

openExample('simulink_automotive/ModelingAFaultTolerantFuelControlSystemExample')
load_system('sldemo_fuelsys');

Get the current block in the fuel_rate_control subsystem.

bl = gcb('sldemo_fuelsys/fuel_rate_control')
bl =

sldemo_fuelsys/fuel_rate_control/validate_sample_time

Input Arguments

collapse all

System that contains the block, specified as a character vector.

Example: 'vdp' 'sldemo_fuelsys/fuel_rate_control'

Version History

Introduced before R2006a