MATLAB: Get numeric handle of imline, impoint etc hggroup

hggroup imline impoint handle

I want to get the numeric handle of hggroup objects such as imline or impoint, from the object that you get when you create these things. This seems to be the inverse of all the questions I can find answered in this area.
I have complicated solutions using findobj after each imline or impoint is created to get the handle value, but this feels clumsy and silly. This feels like some simple function that I'm just not aware of or not using correctly.
(As background, the reason I want the numeric handle is to quickly compare with a figure's "currentobject" function during user interaction).

Best Answer

One way to do it:
h = imline;
numeric_handle = findobj(h,'-depth',0)