Get numeric handle of imline, impoint etc hggroup

2 views (last 30 days)
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).

Accepted Answer

Teja Muppirala
Teja Muppirala on 31 Jul 2012
One way to do it:
h = imline;
numeric_handle = findobj(h,'-depth',0)
  3 Comments
Ben
Ben on 31 Jul 2012
Thanks Teja. Nice one line solution.
Peter
Peter on 16 Aug 2013
Does seem silly that you have to use findobj to get the handle of an object you just created. Its even worse that the handle isn't returned to the NewPositionCallback - making the built in imline pretty useless.

Sign in to comment.

More Answers (0)

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!