gcbo

Returns the object whose callback is currently executing.

Category: Graphics > Graphics Objects

Syntax

obj = gcbo

Returns the callback object, or an empty object when no callback is running.

Description

Callbacks normally receive the source object as their first argument, which is the cleaner way to reach it. gcbo is the older alternative, useful when a callback is a plain function without arguments. Outside a callback it is empty.

Output arguments

obj
Handle of the object that triggered the callback, or an empty placeholder.

Example

Outside a callback

o = gcbo;
disp(class(o))
Output
matlab.graphics.GraphicsPlaceholder

See also

gcbf gco gcf ancestor