% merge subplots
% do >> handle=[];for jj=1:number_figures_to_merge
% handle(jj,1)=[figure(jj)];end
% then pass handle to this function;
% see set_subplot_positions for fixing ylabels and positions
function merge_subplots(handle);
tmp=get(handle(1),'Children');
c=length(tmp);
r=length(handle);
 hf2=figure(200);
 z=1;
for jj=1:r;

    
%     
%        figure(100);
%    plot(rand(100,1));grid
%    title('some title'),xlabel('time');ylabel('amplitude')
   hax1=get(handle(jj),'Children');
  for kk=length(hax1):-1:1;
   s1=subplot(r,c,z);
   pos=get(s1,'Position');
   delete(s1);
   hax2=copyobj(hax1(kk),hf2);
   set(hax2, 'Position', pos);
   z=z+1;
  end
end
    
