123 lines
4.3 KiB
Matlab
Executable File
123 lines
4.3 KiB
Matlab
Executable File
%EZcompositePlot
|
|
global Exp
|
|
global ghandles
|
|
|
|
if (Exp(expN).cTraceN>1 && length(Exp(expN).ll)<=(Exp(expN).cTraceIndx((Exp(expN).cTraceN)))) ||...
|
|
isempty(Exp(expN).ll)
|
|
return;
|
|
end
|
|
Exp(expN).CompositPlot=1;
|
|
|
|
if expN==1, OLaxes=ghandles.OLaxes1; end
|
|
if expN==2, OLaxes=ghandles.OLaxes2; end
|
|
if expN==3, OLaxes=ghandles.OLaxes3; end
|
|
|
|
cTraceN=mod(Exp(expN).cTraceN,10);
|
|
%cTraceN=Exp(expN).cTraceN;
|
|
if cTraceN==1, colour='b';
|
|
elseif cTraceN==2, colour='g';
|
|
elseif cTraceN==3, colour='r';
|
|
elseif cTraceN==4, colour='c';
|
|
elseif cTraceN==5, colour='m';
|
|
elseif cTraceN==6, colour='b';
|
|
elseif cTraceN==7, colour='g';
|
|
elseif cTraceN==8, colour='r';
|
|
elseif cTraceN==9, colour='c';
|
|
elseif cTraceN==0, colour='m';
|
|
end
|
|
|
|
AddCplot=1; %Test need for user question dialog boxS
|
|
if AddCplot==1,
|
|
cTraceN=Exp(expN).cTraceN
|
|
cTraceIndx=Exp(expN).cTraceIndx(cTraceN)
|
|
cTstart=cTraceIndx;
|
|
cTend=length(Exp(expN).ll);
|
|
|
|
jj=0; ii=0; RFcmpTraces=0; maxRFcmpLStd=0; maxRFcmpKStd=0; maxRFcmprStd=0;
|
|
for ic=cTstart:cTend
|
|
if strcmp(get(Exp(expN).hOL(ic),'visible'), 'on')
|
|
jj=jj+1;
|
|
mlstL(jj)=Exp(expN).ll(ic); mlstR(jj)=Exp(expN).rr(ic); mlstK(jj)=Exp(expN).kk(ic);
|
|
LBcheck=char(Exp(expN).hOLname(ic))
|
|
if isequal(LBcheck(4:6),'cmp'),
|
|
if Exp(expN).lstd(ic)> maxRFcmpLStd
|
|
maxRFcmpLStd=Exp(expN).lstd(ic);
|
|
ii=ii+1;
|
|
lstds(ii)=Exp(expN).lstd(ic);
|
|
RFcmpTraces(ii)=ic;
|
|
end
|
|
if Exp(expN).kstd(ic)> maxRFcmpKStd
|
|
maxRFcmpKStd=Exp(expN).kstd(ic);
|
|
end
|
|
if Exp(expN).rstd(ic)> maxRFcmprStd
|
|
maxRFcmprStd=Exp(expN).rstd(ic);
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
maxLstd=max(std(mlstL), maxRFcmpLStd);
|
|
maxKstd=max(std(mlstK), maxRFcmpKStd);
|
|
maxrstd=max(std(mlstR), maxRFcmprStd);
|
|
Exp(expN).cLmean(cTraceN)=mean(mlstL); Exp(expN).cLstd(cTraceN)=maxLstd;
|
|
Exp(expN).cRmean(cTraceN)=mean(mlstR); Exp(expN).cKstd(cTraceN)=maxKstd; %std(mlstR);
|
|
Exp(expN).cKmean(cTraceN)=mean(mlstK); Exp(expN).cRstd(cTraceN)=maxrstd; %std(mlstK);
|
|
|
|
% Mean calculation plot
|
|
l=Exp(expN).cLmean(cTraceN);
|
|
r=Exp(expN).cRmean(cTraceN);
|
|
K=Exp(expN).cKmean(cTraceN);
|
|
lslow=l + Exp(expN).cLstd(cTraceN); lfast=l - Exp(expN).cLstd(cTraceN);
|
|
rl=r - Exp(expN).cRstd(cTraceN); ru=r + Exp(expN).cRstd(cTraceN);
|
|
Kl=K - Exp(expN).cKstd(cTraceN); Ku=K + Exp(expN).cKstd(cTraceN);
|
|
clear g;
|
|
t=1:200;
|
|
g=K ./ (1 + exp(-r.* (t - l )));
|
|
gSlow=Kl ./ (1 + exp(-rl.* (t - lslow )));
|
|
gFast=Ku ./ (1 + exp(-ru.* (t - lfast )));
|
|
if K==0||r==0||l==0
|
|
g(1:200)=1;gSlow(1:200)=1;gFast(1:200)=1;
|
|
end
|
|
|
|
Exp(expN).hCmean(cTraceN)=plot(OLaxes,t,g);hold on; % plot the composit mean of traces
|
|
Exp(expN).hBound1(cTraceN)=plot(OLaxes,t,gSlow,'y');
|
|
Exp(expN).hBound2(cTraceN)=plot(OLaxes,t,gFast,'y');
|
|
%c1=c1-((cTraceN-1)*0.2); c2=c2+((cTraceN-1)*0.2); c3=c3+((cTraceN-1)*0.2);
|
|
set(Exp(expN).hCmean(cTraceN),'color',colour) %[c1 c2 c3]) %Set latest trace red
|
|
set(Exp(expN).hCmean(cTraceN),'linewidth',3)
|
|
Lstr=num2str(Exp(expN).cLmean(cTraceN)); Lsstr=num2str(Exp(expN).cLstd(cTraceN));
|
|
Rstr=num2str(Exp(expN).cRmean(cTraceN)); Rsstr=num2str(Exp(expN).cRstd(cTraceN));
|
|
Kstr=num2str(Exp(expN).cKmean(cTraceN)); Ksstr=num2str(Exp(expN).cKstd(cTraceN));
|
|
|
|
try
|
|
cPlotLB=strcat('Composite', num2str(cTraceN),'->','L=',Lstr(1:4),';','Ls=',Lsstr(1:4),';',...
|
|
'r=',Rstr(1:4),';','rs=',Rsstr(2:6),';','K=',Kstr(1:4),';','Ks=',Ksstr(1:4))
|
|
catch
|
|
try
|
|
cPlotLB=strcat('Composite', num2str(cTraceN),'->','L=',Lstr(1:4),';','r=',Rstr(1:4),';','K=',Kstr(1:4),'-SingleSource');
|
|
catch
|
|
end
|
|
end
|
|
|
|
Exp(expN).cName(cTraceN)={cPlotLB};
|
|
if expN==1, set(ghandles.OLay1,'string', cPlotLB); end
|
|
if expN==2, set(ghandles.OLay2,'string', cPlotLB); end
|
|
if expN==3, set(ghandles.OLay3,'string', cPlotLB); end
|
|
|
|
% Hide source traces leaving only the Composite traces and STD traces
|
|
for i=1:length(Exp(expN).hOL)
|
|
set(Exp(expN).hOL(i),'Visible','off')
|
|
try set(Exp(expN).hOLb(i),'Visible','off')
|
|
catch
|
|
msg='No raw data RFcmp'
|
|
end
|
|
end
|
|
|
|
% Increment the CompositeTrace count and update the correlated reference OLAY cTraceIndx
|
|
Exp(expN).cTraceN=(Exp(expN).cTraceN) + 1 ;
|
|
Exp(expN).cTraceIndx(Exp(expN).cTraceN)=length(Exp(expN).hOL(:))+1;
|
|
|
|
%cPlotLB=strcat('Composite', num2str(cTraceN),'L=',num2str(Exp(expN).cLmean(cTraceN)),'Ls=',num2str(Exp(expN).cLstd(cTraceN))) %,'-',(Exp(expN).hOLname(cTraceIndx)))
|
|
%Exp(expN).cName(cTraceN)={cPlotLB};
|