Documentation

我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

gcb

Get path name of current block

Syntax

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

See Also

| |

Introduced before R2006a


Was this topic helpful?