Here is the complete code in case u need more information: (this is an example of each of the figure names opened (CONT_1_1_fit)
clear
if true
station='CONT'; %handles comes from stationlist1
end
load(sprintf ('%s_fits.mat',station));
fields = (fieldnames(Fits));
nim=numel(fields); %number of figures in directory
%decompose names using textscan & detect profnum and shorenum values
for i=1:nim
str=fields{i,1};
all(i,:)=textscan(str,'%s','delimiter','_');
all(i,:)=textscan(str,'%s','delimiter','_');
profnum=str2double(all{i,1}{2,1});
shorenum=str2double(all{i,1}{3,1});
% define the values station profnum y shorenum for next eq
myFigstruct=Fits.(sprintf('%s_%u_%u_fit',station,profnum,shorenum));
% The line below converts the struct "this_fig" back to a figure handle and displays it.
h1(i) = struct2handle(myFigstruct,0);
Xll(i,:)=myFigstruct.children(1,1).properties.XLim;
Yll(i,:)=myFigstruct.children(1,1).properties.YLim;
findobj(h1,'Type','line');
end
%%%%%%%%%%%%%%%%DONT close any figure %%%%%%%%%%%%%%%%%%%%%
%%copying and pasting active objects & creating of multiple pages
ps=8;% plots per page
np=nim; %number of plots
for it=1:np
xt=rem(it-1,ps)+1;
if xt==1
figure;
end
ax1=subplot(4,2,xt);
%title(sprintf('plot #%-1d',it));
xlim(Xll(it,:)); %xlimits, come from figure structure
ylim(Yll(it,:)); %ylimits, come from figure structure
copyobj(allchild(get(h1(it),'CurrentAxes')),ax1);
%check this
fout = sprintf('%s_DR.pdf',station);
saveas(gcf,fout,'pdf');
end