To get a specific type of object's handle, try using findobj
to look for a specific 'Type'
property. For example,
ha1 = findobj(h1,'Type','axes');
However, you can probably just apply copyobj
(instead of changing the 'parent'
:
copyobj(ha1,hf2)
This way you can copy the axes (ha1
) to a new figure (hf2
). You can do the same with any graphics element, like copying a plot ('Type'
of 'line'
) to a new axes.