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.

gcb

Get path name of current block

Syntax

bl = gcb
bl = gcb(sys)

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.

Input Arguments

collapse all

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

Example: 'vdp' 'sldemo_fuelsys/fuel_rate_control'

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.

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

Introduced before R2006a

Was this topic helpful?