Contenuto principale

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 the MultiCounter model.

openExample("simulink_features/ComponentBasedModelingUsingModelReferenceExample")

Select a block in the model hierarchy. For example, in the CounterA instance of LimitedCounter, select the Unit Delay block.

In the MATLAB® Command Window, use the gcbp function.

path = gcbp
path = 

  Simulink.BlockPath
  Package: Simulink

  Block Path:
    MultiCounter/CounterA
      LimitedCounter/Unit Delay

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

  Methods

Version History

Introduced in R2019a

See Also

Objects

Functions