function cfFRET=errorcalc(nuFRET)
cfFRET=nuFRET;
%% Reads structured Array with bleaching markers (A_bleached,D_bleached)
%% and calculates background, crosstalk and no gamma correction
for k=1:length(nuFRET)
tA=nuFRET(1,k).A_bleached;
tD=nuFRET(1,k).D_bleached;
t_Dsolo=tD-tA;

ID_Dsolo=sum(nuFRET(1,k).counts(tA:tD,1));
IA_Dsolo=sum(nuFRET(1,k).counts(tA:tD,2));
duration=size(nuFRET(1,k).counts,1);
tdark=duration-tD;
cfFRET(1,k).bgsum=sum(nuFRET(1,k).counts(tD:end,:));
bg=cfFRET(1,k).bgsum/tdark;


cfFRET(1,k).bg=bg;
cfFRET(1,k).cross=(IA_Dsolo-bg(1,2)*t_Dsolo)/t_Dsolo;
cfFRET(1,k).machine_gamma=1;
clear tA tD IDsolo IAsolo duration tdark bg


end



