I created a GUI that which saves its setting by saving as a .fig file (hgsave or savefig). However Im noticing a weird error where if the figure in the GUI contains any IMROI objects (such as imellipse) then after reloading the figure (hgload or loadfig) then I can no longer use any Imroi functions in that figure (I cant create/delete imroi objects or use their functions). The error that I get is 'Error using hittest Invalid object handle'. I have done some digging around and found that there is a crucial line in ellipseSymbol: h_fig = iptancestor(h_axes,'figure'); Where (Im guessing)it gets an invalid handle of the 'original' figure that created it (before reloading). If I change this line to h_fig = gcf; then it works just fine.
I cannot find any documentation on this iptancestor property and therefore am at a loss how to fix this.
Can anybody help me along with this? Is there maybe a way to 'reset' this ancestor property? Any help is appreciated