Commit a9e20c4e authored by drobot's avatar drobot

Update on the code 'BuildAndFit' to make it work more general

parent 90ce5a74
%%%%%%%%%%%%%%Build And Measure %%%%%%%%%%%%%%Build And Measure
clear all; close all; clc clear all; close all; clc
AnzExp=1; % You can choose between monoexponential (1) or biexponential (2) fitting AnzExp=1; % You can choose between monoexponential (1) or biexponential (2)
timeMax=0; % Maximal time for analysis (0 - all time points were analysed) timeMax=0; % Maximal time for analysis (0 - all time points were analysed)
...@@ -28,7 +28,7 @@ i=i-1; ...@@ -28,7 +28,7 @@ i=i-1;
idx=find(sampleorder{i}=='_'); idx=find(sampleorder{i}=='_');
AllNames=sampleorder{i}(idx+1:end); AllNames=sampleorder{i}(idx+1:end);
Num = regexp(AllNamesidx,'\d'); Num = regexp(AllNamesidx,'\d');
AllNames(end-7:end)=[]; AllNames(end-3:end)=[];
AllNames(Num)=[]; AllNames(Num)=[];
clear i endung FileNames Sortierung Num AllNamesidx sampleorder Names2 idx index clear i endung FileNames Sortierung Num AllNamesidx sampleorder Names2 idx index
...@@ -39,14 +39,14 @@ FRAPtype = input('spot in droplet (1), bulk phase (2), whole droplet (3): '); ...@@ -39,14 +39,14 @@ FRAPtype = input('spot in droplet (1), bulk phase (2), whole droplet (3): ');
%% Read and normalise data %% Read and normalise data
for i=1:length(Names) for i=1:length(Names)
assignin ('base',['Image' num2str(Names(i))], dlmread(sprintf(['timeSeries_' AllNames num2str(Names(i)) '_Out.txt']),'\t',1,0)); assignin ('base',['Image' num2str(Names(i))], dlmread(sprintf(['timeSeries_' AllNames num2str(Names(i)) '.txt']),'\t',1,0));
if timeMax==0 if timeMax==0
tend=length(dlmread(sprintf(['timeSeries_' AllNames num2str(Names(i)) '_Out.txt']),'\t',1,0)); tend=length(dlmread(sprintf(['timeSeries_' AllNames num2str(Names(i)) '.txt']),'\t',1,0));
else else
assignin ('base',['time'], evalin('base',sprintf(['Image' num2str(Names(i)) '(1:end,1)']))); assignin ('base',['time'], evalin('base',sprintf(['Image' num2str(Names(i)) '(1:end,1)'])));
tend=find(time>timeMax); tend=find(time>timeMax);
if isempty(tend) if isempty(tend)
tend=length(dlmread(sprintf(['timeSeries_' AllNames num2str(Names(i)) '_Out.txt']),'\t',1,0)); tend=length(dlmread(sprintf(['timeSeries_' AllNames num2str(Names(i)) '.txt']),'\t',1,0));
else else
tend=tend(1); tend=tend(1);
end end
...@@ -69,7 +69,7 @@ for i=1:length(Names) ...@@ -69,7 +69,7 @@ for i=1:length(Names)
assignin ('base',['NormDrop' num2str(Names(i))], evalin('base',sprintf(['NormRef' num2str(Names(i))]))); assignin ('base',['NormDrop' num2str(Names(i))], evalin('base',sprintf(['NormRef' num2str(Names(i))])));
elseif FRAPtype==2 % bulk phase elseif FRAPtype==2 % bulk phase
assignin ('base',['RawBG' num2str(Names(i))], evalin('base',sprintf(['Raw' num2str(Names(i))]))); assignin ('base',['RawBG' num2str(Names(i))], evalin('base',sprintf(['Raw' num2str(Names(i))])));
assignin ('base',['NormRef' num2str(Names(i))], evalin('base',sprintf(['RawBG' num2str(Names(i))]))); assignin ('base',['NormRef' num2str(Names(i))], evalin('base',sprintf(['RawBG' num2str(Names(i)) './RawBG' num2str(Names(i)) '(:,2)' ])));
assignin ('base',['NormDrop' num2str(Names(i))], evalin('base',sprintf(['NormRef' num2str(Names(i))]))); assignin ('base',['NormDrop' num2str(Names(i))], evalin('base',sprintf(['NormRef' num2str(Names(i))])));
elseif FRAPtype==1 % spot in droplet ==> double normalization elseif FRAPtype==1 % spot in droplet ==> double normalization
assignin ('base',['RawBG' num2str(Names(i))], evalin('base',sprintf(['Raw' num2str(Names(i)) '-Raw' num2str(Names(i)) '(:,4)' ]))); assignin ('base',['RawBG' num2str(Names(i))], evalin('base',sprintf(['Raw' num2str(Names(i)) '-Raw' num2str(Names(i)) '(:,4)' ])));
...@@ -77,7 +77,7 @@ for i=1:length(Names) ...@@ -77,7 +77,7 @@ for i=1:length(Names)
assignin ('base',['NormDrop' num2str(Names(i))], evalin('base',sprintf(['NormRef' num2str(Names(i)) './ NormRef' num2str(Names(i)) '(:,2)' ]))); assignin ('base',['NormDrop' num2str(Names(i))], evalin('base',sprintf(['NormRef' num2str(Names(i)) './ NormRef' num2str(Names(i)) '(:,2)' ])));
end end
assignin ('base',['timetrace' num2str(Names(i))], evalin('base',sprintf(['NormDrop' num2str(Names(i)) '(1:tend,1)/mean( NormDrop' num2str(Names(i)) '(1:t0(i)-1,1))' ]))); assignin ('base',['timetrace' num2str(Names(i))], evalin('base',sprintf(['NormDrop' num2str(Names(i)) '(1:tend,1)/mean( NormDrop' num2str(Names(i)) '(1:t0(i)-1,1))' ])));
assignin ('base',['Diam' num2str(Names(i))], dlmread(sprintf(['Measurements_' AllNames num2str(Names(i)) '_Out.txt']),'\t',[1 8 1 8])); assignin ('base',['Diam' num2str(Names(i))], dlmread(sprintf(['Measurements_' AllNames num2str(Names(i)) '.txt']),'\t',[1 8 1 8]));
assignin ('base',['time' num2str(Names(i))], evalin('base',sprintf(['Image' num2str(Names(i)) '(1:tend,1)']))); assignin ('base',['time' num2str(Names(i))], evalin('base',sprintf(['Image' num2str(Names(i)) '(1:tend,1)'])));
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment