MATLAB: How to open a figure, using openfig, containing subplots and force hold on to cycle through subplot regions

hold on; subplot; open; openfigMATLAB

For my first attempt I tried:
Note: I hid the filename but it loads just fine
fig = openfig('*****.fig');
a = get(fig);
hold on
subplot(2,1,1);
errorbar(x,av1,e1,'-d','MarkerSize',10,'Color',[1 165/256 0]);
hold on
subplot(2,1,2);
errorbar(x,av2,e2,'-d','MarkerSize',10,'Color',[1 165/256 0]);
but this just overwrites fig in both subplots (I found out that any time you type subplot(m,n,p) it will wipe out any pre-loaded axes).
I then tried getting rid of the subplot function, but it only applies the new graphical output to the SECOND subplot region
fig = openfig('ER_SvA_discrete.fig');
a = get(fig);
hold on
errorbar(x,av1,e1,'-d','MarkerSize',10,'Color',[1 165/256 0]);
hold on
errorbar(x,av2,e2,'-d','MarkerSize',10,'Color',[1 165/256 0]);
Is there a way to load up that figure, select subplot(2,1,1), hold on, errrorbar; then move to subplot(2,1,2) and do the same thing?
Cheers,
Alex

Best Answer

bothax = findobj(fig,'type','axes');
hold(bothax, 'on');
errorbar(bothax(2), x,av1,e1,'-d','MarkerSize',10,'Color',[1 165/256 0]);
errorbar(bothax(1), x,av2,e2,'-d','MarkerSize',10,'Color',[1 165/256 0]);
note that the second subplot is likely to be the first of the two axes in the Child order