gcbp

Get Simulink.BlockPath object for current block

Syntax

obj = gcbp

Description

example

obj = gcbp returns the Simulink.BlockPath object of the current block in the current system. The current block is:

  • The most recently clicked block

  • The last block loaded after opening a model

The returned Simulink.BlockPath object is context sensitive to model hierarchy.

Examples

collapse all

Open sldemo_mdlref_basic.

sldemo_mdlref_basic

Click a block in the model hierarchy. For example, click the block labeled ScopeA in the CounterA instance of sldemo_mdlref_counter. Then, enter obj = gcbp at the command prompt.

obj = gcbp
obj = 

  Simulink.BlockPath
  Package: Simulink

  Block Path:
    sldemo_mdlref_basic/CounterA
      sldemo_mdlref_counter/ScopeA

  Use the getBlock method to access block path strings from this object.

  Methods

See Also

| | |

Introduced in R2019a