Main Content

gcbp

Get Simulink.BlockPath object for current block

Description

path = 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.

example

Examples

collapse all

Open sldemo_mdlref_basic.

openExample('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, use gcbp in the Command Window.

path = gcbp
path = 

  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

Version History

Introduced in R2019a

See Also

Objects

Functions