%% Return Top-Level Ancestor
% Create Line objects and parent them to a Group object. Then return the top-level ancestor.

g = hggroup;
ln = line(randn(5),randn(5),'Parent',g);

%

tp = ancestor(g,{'figure','axes','hggroup'},'toplevel')

% Copyright 2012 The MathWorks, Inc.