Main Content

gcb

Get path name of current block

Description

example

bl = gcbreturns 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 theMaskInitializationparameter 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 theGainblock. Then, entergcbat the command prompt.

gcb
ans = vdp/Mu

Open a model.

vdp

Select theGainblock.

Use the value ofgcbwithget_paramto get the value of theGainparameter.

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

Load theModeling a Fault-Tolerant Fuel Control Systemexample modelsldemo_fuelsys.

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

Get the current block in thefuel_rate_controlsubsystem.

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