MATLAB Functions | Help Desk |
gco
Return handle of current objecth = gco h = gco(h)
h = gco
returns the handle of the last graphics object you clicked on with the mouse or the last graphics object created.
h = gco(h)
returns the value of the current object for the Figure specified by h
.
MATLAB stores the handle of the current object in the Figure's CurrentObject
property.
The CurrentObject of the CurrentFigure does not always indicate the object whose callback is being executed. Interruptions of callbacks by other callbacks can change the CurrentObject or even the CurrentFigure. Some callbacks, such as CreateFcn and DeleteFcn, and uimenu Callback intentionally do not update CurrentFigure or CurrentObject. gcbo provides the only completely reliable way to retrieve the handle to the object whose callback is executing, at any point in the callback function, regardless of the type of callback or of any previous interruptions.
Return the handle to the current graphics object in Figure 2:
h = gco(2)
gca
, gcbo
, gcf
, root