%%      MultiPlot uncorrected for uc=2, corrected for uc=1
%uc=1;
uc=2;
t=1;
m=0;
for uc=1:2
    for s=1:17
      figure(s+m)
      sp=1;
      
        for p1=1:10
        
        ende=size(uFRET(uc,t).eff50,1);
        xTix=[0,round(ende/4),ende-round(ende/4),ende];
        xTix(end)=ende;
        xTixL=round(xTix*10^(-5)*100)/100;
        yMax=max(max(uFRET(uc,t).ints50));
   
            subplot(10,3,3*p1-2:3*p1-1) 
    
                 plotI=line(1:ende,uFRET(uc,t).ints50(1:ende,1:2));
                    set(plotI(1),'Color',[0.702 0.7804 1]);
                    set(plotI(2),'Color',[0.7569 0.8667 0.7765]);
               
                       ax1 = gca;
                        set(ax1, 'YColor','b','YAxisLocation','left',...
                        'Color','none','xtick',[],'XLim',[0,ende],'YLim',[0,yMax]);
             if t>42
                set(get(ax1,'XLabel'),'String',...
                    ['time in sec #',num2str(t),' - ',uFRET(uc,t).names(7:9),uFRET(uc,t).names(17:20)])   
             else
                set(get(ax1,'XLabel'),'String',...
                    ['time in sec #',num2str(t),' - ',uFRET(uc,t).names(1:2),uFRET(uc,t).names(11:14)])
             end

             if (uc==1)
                        ylabel(ax1,'Intensities (cor)');
             else
                        ylabel(ax1,'Intensities (uc)');
             end
                       ax2 = axes('Position',get(ax1,'Position'),...
                          'YAxisLocation','right',...
                          'Color','none','XColor','k','YColor','k',...
                          'xtick', xTix, 'XTickLabel', xTixL, 'XLim',[0,ende],...
                           'YLim',[0,1],'YTick',[0.5,1],'YTickLabel',{});
    
                line(1:ende,uFRET(uc,t).eff50,'Color','k','Parent',ax2);             
                   ylabel(ax2,'Efficiency')
                  set(ax2,'Position',get(ax1,'Position'));
                  

            subplot(10,3,3*p1) 
            
                hist(uFRET(uc,t).eff50,100);
                newCamera=get(gca,'CameraPosition')*[1 0 0;0 1 0;0 0 -1];
                set(gca, 'Color','none',...
                  'YAxisLocation','right','YColor','k',...
                  'CameraUpVector', [1,0,0],'CameraPosition',newCamera, 'Box','off')
                 ylabel(gca,'counts');    
             
             t=t+1
           
        end
     end
m=20;
t=1
end


%%
figure(10)

subplot(4,1,1);set(gca, 'CameraUpVector', [1,0,0]); 
set(gca,  'OuterPosition', [0,0,0.2,1])
plot(nuFRET(1,16).eff100);
subplot(4,1,2);plot(nuFRET(1,16).eff50);set(gca, 'CameraUpVector', [1,0,0]) ;
set(gca,  'OuterPosition', [0.21,0,0.2,1])
subplot(4,1,3);plot(nuFRET(1,16).eff20);set(gca, 'CameraUpVector', [1,0,0]) ;
set(gca,  'OuterPosition', [0.41,0,0.2,1])
subplot(4,1,4);plot(nuFRET(1,16).eff10);set(gca, 'CameraUpVector', [1,0,0]) ;
set(gca,  'OuterPosition', [0.61,0,0.2,1])
figure(10)

subplot(4,1,1);plot(nuFRET(1,16).eff100);set(gca, 'CameraUpVector', [1,0,0]); 
subplot(4,1,2);plot(nuFRET(1,16).eff50);set(gca, 'CameraUpVector', [1,0,0]) ;
subplot(4,1,3);plot(nuFRET(1,16).eff20);set(gca, 'CameraUpVector', [1,0,0]) ;
subplot(4,1,4);plot(nuFRET(1,16).eff10);set(gca, 'CameraUpVector', [1,0,0]) ;


%%
figure(20)
for l=1:13
    
    for k=1:1:10
figure(l)
subplot(10,1,k); plot(nuFRET(1,-10+10*l+k).eff20(:,1));

title(['#',num2str(-10+10*l+k),' - ', nuFRET(1,-10+10*l+k).names])
text(nuFRET(1,-10+10*l+k).A_bleached,nuFRET(1,-10+10*l+k).eff20(nuFRET(1,-10+10*l+k).A_bleached,1),...
 ' \leftarrow Acceptor bleached',...
 'Rotation',45);
text(nuFRET(1,-10+10*l+k).D_bleached,nuFRET(1,-10+10*l+k).eff20(nuFRET(1,-10+10*l+k).D_bleached,1),...
 ' \leftarrow Donor bleached',...
 'Rotation',45);
%set(gca,'Position',[0.003 1-0.098*k 0.98 0.09])
set(gca,'XTickLabel',[],'ytick',[],...
        'TickLength',[0.004,0.001],...
        'XMinorGrid','on','XAxisLocation','top','XMinorGrid','off','XAxisLocation','top');
    end
end  

%%
   figure(23)


   for k=1:1:12
subplot(12,1,k); plot(nuFRET(1,visualStates(k,1)).eff100(1:nuFRET(1,visualStates(k,1)).A_bleached+500));
title(['#',num2str(visualStates(k,1)),' - ', nuFRET(1,visualStates(k,1)).names])
%set(gca,'Position',[0.003 1-0.098*k 0.98 0.09])
set(gca,'ytick',[],...
        'TickLength',[0.004,0.001],...
        'XMinorGrid','on','XAxisLocation','top','XMinorGrid','off','XAxisLocation','top');
l=1;        
        while SChange(k,l)>0;
text(SChange(k,l),nuFRET(1,visualStates(k)).eff20(SChange(k,l),1),' \leftarrow ij','Rotation',75);
l=l+1;
        end
   end
   
%%
       for k=1:1:12
subplot(12,1,k); plot(nuFRET(1,visualStates(k,1)).eff100(1:nuFRET(1,visualStates(k,1)).A_bleached+500));
title(['#',num2str(visualStates(k,1)),' - ', nuFRET(1,visualStates(k,1)).names])
%set(gca,'Position',[0.003 1-0.098*k 0.98 0.09])
set(gca,'ytick',[],...
        'TickLength',[0.004,0.001],...
        'XMinorGrid','on','XAxisLocation','top','XMinorGrid','off','XAxisLocation','top');
l=1;        
        while SChange(k,l)>0;
text(SChange(k,l),nuFRET(1,visualStates(k)).eff20(SChange(k,l),1),...
 ' \leftarrow j \rightarrow j','Rotation',75);
l=l+1;
        end
       end
       
      %%------------------------------- 
       figure(33)
for k=1:12
    l=1;
       while SChange(k,l)>0;
    subplot(12,6,l+k-1); bar(StateAnalysis(l,k).Imean)
    l=l+1;
       end
       subplot(12,6,(l+k):6*i)
       plot(nuFRET(1,visualStates(k,1)).eff100(1:nuFRET(1,visualStates(k,1)).A_bleached+500))
end
Evar(1:12,1:4)=zeros
for k=1:12
    l=1;
       while SChange(k,l)>0;
            Evar(k,1:4)=Evar(k,1:4)+StateAnalysis(l,k).Evar
        l=l+1
       end
 
end
%%
