gcbh
R2026bGet handle of current block
Syntax
Description
returns the handle of the
current block in the current system.handle = gcbh
The current block is:
The most recently clicked block; when you select multiple blocks using a selection box, it is the first block that gets selected
The S-Function block currently running its MATLAB® function
When a callback is invoked, the block invoking the callback; the current block can change during the execution of the callback, for example if you set breakpoints or interact with an editor.
The block whose mask is being evaluated as part of the
MaskInitializationparameter evaluation, provided the mask initialization code does not change the current blockThe last block loaded after opening a model
The current system is one of these:
During editing, the most recently clicked subsystem or the subsystem that contains the most recently clicked block; if the most recent click is in the top level of the model hierarchy, the current system is the model.
During simulation of a model that contains an S-Function block, the subsystem containing the S-Function block currently being evaluated; if the S-Function being evaluated is in the top level of the model hierarchy, the current system is the model.
When a callback is invoked, the model, subsystem, or block invoking the callback; the current system can change during the execution of the callback, for example if you set breakpoints or interact with an editor.
During evaluation of the
MaskInitializationfunction, the subsystem containing the block whose mask is being evaluated; if the mask is in the top level of the model hierarchy, the current system is the model.The model most recently loaded into memory with the
load_systemfunction.If you load a model using the
load_systemfunction and then change the current system, loading the model a second time using theload_systemfunction does not make the model the current system. To make the model the current system, close the model and then reload the model using theload_systemfunction.
Use the gcs function to determine the current
system.
Examples
Output Arguments
Version History
Introduced before R2006a
See Also
gcb | gcbp | gcs | getSimulinkBlockHandle | get_param