try
close(inst_plot);
catch
    fprintf('Already closed');
end

inst_plot=figure;
set(inst_plot,'name','Spec STATS');

t=get(Dhand.Time_Select,'value');
    switch t,
     case 1
        t=1;
      case 2
        t=3;
     case 3
        t=7;
     case 4
        t=100000; 
    end % switch
tind=find(Drift.specprr(1,:)>=now-t);
XLim=[(now-t) now];

subplot(2,1,1)
plot(Drift.specprr(1,tind),Drift.specprr(14:20,tind));
YLim=[0 max(max(Drift.specprr(14:20,tind)))];
set(gca, 'XLim', XLim,'YLim', YLim)
datetick('x');
legend('Lu412','Lu443','Lu490','Lu510','Lu555','Lu670','Lu683',-1);
title(sprintf('%s OCR-100A',graphtitle));
ylabel('uW/m2/nm');
subplot(2,1,2)
plot(Drift.specprr(1,tind),Drift.specprr(22:28,tind));
YLim=[0 max(max(Drift.specprr(22:28,tind)))];
set(gca, 'XLim', XLim,'YLim', YLim)
datetick('x');
legend('Lu412','Lu443','Lu490','Lu510','Lu555','Lu670','Lu683',-1);
title(sprintf('%s OCR-100B',graphtitle));
ylabel('uW/m2/nm');

