% This program analyzes the primary cell Global response and takes off the influence of the secondary responses. %The this program requires the expfit function, which I downloaded from the %Matlab Central: http://www.mathworks.com/matlabcentral/fileexchange/21959-exponential-fit-without-start-guess %and made s1=0 for caseval=1. % Single poke with penetration experiments. clc; clear; files=dir('*.xls'); fileIndex = find(~[files.isdir]); for j=1:length(fileIndex)% the number of files in that folder [status,sheets] = xlsfinfo(files(j).name); numel (sheets); for p=1:1:(numel(sheets)/2);%the number of sheets from which you want to read the data/2, each represents an expeirment [num,txt,raw] = xlsread(files.name,(2*p)-1,'A1');%loads the information on the entire sheet Data.Name{j}{p}= txt;%Reads the name of the file, which is located in the first entry of the sheet (2*i)-1 Data.RAW{j}{p}= xlsread(files.name,p*2); %reads the data a=[Data.Name{j}{p}]; NoFrames =numel(Data.RAW{j}{p}(:,1));%the number of frames NoCells =numel(Data.RAW{j}{p}(1,:));%the number of ellipses Data.NoCells{j}{p}=numel(Data.RAW{j}{p}(1,:)); frame=(1:1:NoFrames); Data.TimePerFrame=.335; % +-10ms on average as calculated from the force curves this can be changed accordingly with every sequence colours='bgmckrbgmckr'; for k=1:NoCells Data.Cell{j}{p}{k} =Data.RAW{j}{p}(:,k);%the number of ellipses % right now Data.Cell{j}{i}{k} contains the kth column intensity % profile of the ith sheet in the jth file end Data.LocalInt{j}{p}=Data.Cell{j}{p}{1}; Data.PrimaryInt{j}{p}=Data.Cell{j}{p}{2}; Data.Vector{j}{p}=Data.Cell{j}{p}{3}; for l=4:1:NoCells Data.Vector{j}{p}=[Data.Vector{j}{p}, Data.Cell{j}{p}{l}]; end %getting the linear combination coefficients for the Primary cell Data.CoeffVec{j}{p} = Data.Vector{j}{p}\Data.PrimaryInt{j}{p}; %%% the linear combination will be given by the dot product of the matrix %%% CELL and the Vector. Data.LinearComb{j}{p} = Data.Vector{j}{p} * Data.CoeffVec{j}{p}; Data.Cell{j}{p}{NoCells+1} =Data.LinearComb{j}{p}; figure() plot(Data.PrimaryInt{j}{p},'r','LineWidth',2); title('Select the point where the light was turned off') hold on; [x1,y1]=ginput(1);%cuts the data in case the bright field light was on figure(); for k=2:NoCells+1 Data.s{j}{p}{k}=expfit(frame(x1:end),Data.Cell{j}{p}{k}(x1:end) ,1); %here we are doing the fit with the exponential to account for the bleaching Data.y{j}{p}{k}=Data.s{j}{p}{k}(2)*exp(-frame/Data.s{j}{p}{k}(3)); S1=size(Data.Cell{j}{p}{k}(x1:end)); plot((Data.Cell{j}{p}{k}(x1:end)-Data.Cell{j}{p}{k}(end-S1(1)+1)),[colours(k)],'LineWidth',2); hold on; S2=size(Data.y{j}{p}{k}(x1:end)); plot((Data.y{j}{p}{k}(x1:end)-Data.Cell{j}{p}{k}(end-S1(1)+1))',[colours(k)],'LineWidth',2); title([files.name ' Cell_' num2str(p)]); xlabel('frame'); ylabel('Avg Intensity'); legend('Primary','Exp','Cell3','Exp','Cell4','Exp','Cell5','Exp','Cell6','Exp','Cell7','Exp','Cell8','Exp','Cell9','Exp','Cell10','Exp') end plot((Data.Cell{j}{p}{k}(x1:end)-Data.Cell{j}{p}{k}(end-S1(1)+1)),'r.','LineWidth',1); plot((Data.y{j}{p}{k}(x1:end)-Data.Cell{j}{p}{k}(end-S1(1)+1))','r.','LineWidth',2); %the graph plotted in red dots is the linear combination graph, %which has to be compared to the Pirmary response figure() plot(Data.Cell{j}{p}{1}(x1:end)); hold on; plot((Data.Cell{j}{p}{NoCells+1}(x1:end)),'r.','LineWidth',1); title('Compare Primary and LC, Select the point where the response starts'); %If the responses are different, then we can continue with the analysis as follows: %Calculating the Linear combination of the extremes [Inix,Iniy1]=ginput(1); Inix1=Inix+x1; Data.PrimaryIntBefore{j}{p}=Data.Cell{j}{p}{2}(x1:Inix1); Data.PrimaryIntAfter{j}{p}=Data.Cell{j}{p}{2}(end-25:end); Data.PrimaryIntExt{j}{p}=[Data.PrimaryIntBefore{j}{p};Data.PrimaryIntAfter{j}{p}]; Data.VectorExt{j}{p}=[Data.Cell{j}{p}{3}(x1:Inix1);Data.Cell{j}{p}{3}(end-25:end)]; for l=4:1:NoCells Data.CellExt{j}{p}{l}=[Data.Cell{j}{p}{l}(x1:Inix1);Data.Cell{j}{p}{l}(end-25:end)]; Data.VectorExt{j}{p}=[Data.VectorExt{j}{p}, Data.CellExt{j}{p}{l}]; end % %getting the linear combination coefficients for the Primary % cellextremes Data.CoeffVecExt{j}{p} = Data.VectorExt{j}{p}\Data.PrimaryIntExt{j}{p}; %%% the linear combination will be given by the dot product of the matrix %%% CELL and the Vector. Data.LinearCombExt{j}{p} = Data.Vector{j}{p} * Data.CoeffVecExt{j}{p}; Data.Cell{j}{p}{NoCells+2} =Data.LinearCombExt{j}{p}(x1:end); Data.s{j}{p}{NoCells+2}=expfit(frame(x1:end),Data.Cell{j}{p}{NoCells+2},1); %here we are doing the fit with the exponential to account for the bleaching Data.y{j}{p}{NoCells+2}=Data.s{j}{p}{NoCells+2}(2)*exp(-frame(x1:end)/Data.s{j}{p}{NoCells+2}(3)); %unbleaching each cell with the LC extremes exponential Data.UnbLCCell{j}{p}{2}= Data.Cell{j}{p}{2}(x1:end)./(Data.y{j}{p}{NoCells+2})';% Primary cell corrected for bleaching using LCextremes exponential Data.UnbLCCell{j}{p}{NoCells+2}= Data.Cell{j}{p}{NoCells+2}./(Data.y{j}{p}{NoCells+2})';%LC extremes corrected for bleaching using LCextremes exponential figure(); plot(Data.UnbLCCell{j}{p}{2},'b','LineWidth',2); hold on; plot(Data.UnbLCCell{j}{p}{NoCells+2},'g','LineWidth',2); title([files.name ' Cell_' num2str(p) ' Primary vs LC Unbleached']); xlabel('frame'); ylabel('Avg intensity'); legend('Primary', 'LC') %Ask for secondareies GLOBAL= input('Is there GLOBAL RESPONSE? press 1 if there is, enter otherwise:'); if GLOBAL==1 %if there is LOCAL RESPONSE!! Secondary= input('IF THE SECONDARIES ARE INTERFERING WITH THE LINEAR COMBINATION, ENTER THE NUMBER OF THE SECONDARY RESPONSES IN []:'); %DEFINING THE PRIMARY, THE SECONDARY RESPONSES AND THE SOURROUNDING %CELL PROFILES Data.PrimaryCell{j}{p}=Data.Cell{j}{p}{2}(x1:end); Secondary1=[]; Secondary1=[2 Secondary]; % Here we select the elements that are NOT the secondary responses NOR the primary! %We define: NoCellsVector= (2:1:NoCells); %Now r = zeros(1,length(NoCellsVector)-length(Secondary1)-2); r_c = 1; a=NoCellsVector; b=Secondary1; for i = 1:max(a) k = (sum(a==i) - sum(b==i)); if k > 0 for j = 1:k r(r_c) = i; r_c = r_c + 1; end end end NonSecondaryCells=r;%These are indexes of the cells that contribute to the LC, non secondaries % Now we have to take each of the elements and build up the vector % for the Linear Combination for k=1: numel(NonSecondaryCells) %{NonSecondaryCells(k)} THIS IS MY NEW INDEX, IT INDICATES THE CELL WHICH HAS TO BE TAKEN INTO ACCOUNT TO FORM THE LINEAR COMBINATION! Data.LinearCombinationCell{j}{p}{k}=Data.Cell{j}{p}{NonSecondaryCells(k)}(x1:end); end % Building the Vector Matrix to find the linear combination Data.NonSecondaryVector{j}{p}=Data.LinearCombinationCell{j}{p}{1}; for l=2:1:numel(NonSecondaryCells) Data.NonSecondaryVector{j}{p}=[Data.NonSecondaryVector{j}{p}, Data.LinearCombinationCell{j}{p}{l}]; % this matrix contains only the cells around the plate which are not responding end if Secondary>=1 %We have: %Data.PrimaryCell{j}{p} ; which size is (x1:end) %Data.NonSecondaryVector{j}{p}%which is the matrix of the %vectors that will contribute to the LC ; which size is (x1:end) %we now build the extremes vector: %Data.Cell{j}{p}{Secondary1(l)}(x1:end) l=1; Data.SecondaryIntBefore{j}{p}=Data.Cell{j}{p}{Secondary1(l)}(x1:Inix1); Data.SecondaryIntAfter{j}{p}=Data.Cell{j}{p}{Secondary1(l)}(end-25:end); Data.SecondaryIntExt{j}{p}=[Data.SecondaryIntBefore{j}{p};Data.SecondaryIntAfter{j}{p}]; Data.NonSecondaryVectorExt{j}{p}=[Data.Cell{j}{p}{NonSecondaryCells(1)}(x1:Inix1);Data.Cell{j}{p}{NonSecondaryCells(1)}(end-25:end)]; for l=2:1:numel(NonSecondaryCells) Data.NonSecondaryCellExt{j}{p}{l}=[Data.Cell{j}{p}{NonSecondaryCells(l)}(x1:Inix1);Data.Cell{j}{p}{NonSecondaryCells(l)}(end-25:end)]; Data.NonSecondaryVectorExt{j}{p}=[Data.NonSecondaryVectorExt{j}{p}, Data.NonSecondaryCellExt{j}{p}{l}]; end %getting the linear combination coefficients for the Primary cell extremes Data.NonSecondaryCoeffVecExt{j}{p} = Data.NonSecondaryVectorExt{j}{p}\Data.SecondaryIntExt{j}{p}; %%% the linear combination will be given by the dot product of the matrix %%% CELL and the Vector. Data.NonSecondaryLinearCombExt{j}{p} = Data.NonSecondaryVector{j}{p} * Data.NonSecondaryCoeffVecExt{j}{p}; Data.Cell{j}{p}{NoCells+2}=[]; Data.Cell{j}{p}{NoCells+2} =Data.NonSecondaryLinearCombExt{j}{p}; Data.s{j}{p}{NoCells+2}=expfit(frame(x1:end),Data.Cell{j}{p}{NoCells+2},1); %here we are doing the fit with the exponential to account for the bleaching Data.y{j}{p}{NoCells+2}=Data.s{j}{p}{NoCells+2}(2)*exp(-frame(x1:end)/Data.s{j}{p}{NoCells+2}(3)); Data.LinearCombinationS{j}{p}{1}=Data.s{j}{p}{NoCells+2}; Data.LinearCombinationY{j}{p}{1}=Data.y{j}{p}{NoCells+2}; % %unbleaching each cell with the LC extremes exponential Data.UnbPrimaryCell{j}{p}= Data.Cell{j}{p}{2}(x1:end)./Data.LinearCombinationY{j}{p}{1}';% Primary cell corrected for bleaching using LCextremes exponential Data.UnbLCCell{j}{p}{NoCells+2}= Data.Cell{j}{p}{NoCells+2}./(Data.LinearCombinationY{j}{p}{1})';%LC extremes corrected for bleaching using LCextremes exponential else %this is what it will do when there are no secondaries! So the result doesn't change, JUST REDEFINE! for k=3:NoCells Data.LinearCombinationCell{j}{p}{k-2}=Data.Cell{j}{p}{k}(x1:end);%the cells not responding that contribute to the LC end Data.LinearCombinationS{j}{p}{1}=Data.s{j}{p}{NoCells+2};% THIS IS THE EXPONENTIAL COEFFS OF THE extremes LINEAR COMBINATION Data.LinearCombinationY{j}{p}{1}=Data.y{j}{p}{NoCells+2}; %THIS IS THE EXPONENTIAL FIT OF THE extremes LINEAR COMBINATION % %unbleaching each cell with the LC extremes exponential % %unbleaching each cell with the LC extremes exponential Data.UnbPrimaryCell{j}{p}= Data.Cell{j}{p}{2}(x1:end)./Data.LinearCombinationY{j}{p}{1}';% Primary cell corrected for bleaching using LCextremes exponential Data.UnbLCCell{j}{p}{NoCells+2}= Data.Cell{j}{p}{NoCells+2}./(Data.LinearCombinationY{j}{p}{1})';%LC extremes corrected for bleaching using LCextremes exponential % end end figure() plot(Data.UnbPrimaryCell{j}{p}) hold on; plot(Data.UnbLCCell{j}{p}{NoCells+2},'g'); title('Bleaching corrected Primary response and LC, COMPARE!') % NOW WE HAVE TO ANALYZE THE RESPONSES! GLOBAL2= input('Is there still GLOBAL RESPONSE? press 1 if there is, enter otherwise:'); if GLOBAL2==1 %if there is LOCAL RESPONSE!! %MEASURING THE NOISE LEVEL OF THE SIGNAL! %Data.UnbPrimaryCell{j}{p}{q} figure() plot(Data.UnbPrimaryCell{j}{p}) hold on; title('Select the points that limit the interval in which you want to start the NOISE CALCULATION'); xlabel('frame'); ylabel('Avg Fluorescence Intensity'); [xNoise,yNoise] = ginput(2); frame=frame(1:numel(Data.UnbPrimaryCell{j}{p})); [r s] = polyfit(frame(xNoise(1):xNoise(2))', Data.UnbPrimaryCell{j}{p}(xNoise(1):xNoise(2)), 1); %Takes the curve between xNoise1 and xNoise2, and fits a 1st grade polynomial [y_fit Data.delta{j}{p}] = polyval(r, frame(xNoise(1):xNoise(2))', s); %calculates the stdev around the fit plot(frame(xNoise(1):xNoise(2))', y_fit + 2 * Data.delta{j}{p}, ':', frame(xNoise(1):xNoise(2))', y_fit - 2 * Data.delta{j}{p}, ':') %plots the curve and the noise around it Data.Noise{j}{p}=2*mean(Data.delta{j}{p}); % 2 delta corresponding roughly to the 95% confidence interval. The mean is the average of the delta value. Noise={'Noise Intensity'; Data.Noise{j}{p}};%%% save the NOISE LEVEL!!! %xlswrite(files.name, Noise, (i*2)-1, 'B3'); %xlswrite(files.name,Data.Noise{j}{i},(i*2)-1,'B4'); % f=figure; % h = uicontrol('Position',[20 20 200 40],'String','Continue',... % 'Callback','uiresume(gcbf)'); plot(Data.UnbPrimaryCell{j}{p}, [colours(2)], 'LineWidth',1); hold on; Data.UnbPrimaryCellS{j}{p}=smooth(Data.UnbPrimaryCell{j}{p}); plot(Data.UnbPrimaryCellS{j}{p}, [colours(2)], 'LineWidth',2); title('SELECT THE START AND END OF EACH OF THE GLOBAL RESPONSE; the start:determines the basal and A') xlabel('frame') ylabel('Avg Fluorescence Intensity') % uiwait(gcf); Data.NoPeaks{j}{p}= 1;%input('How many peaks do you want to analyze?'); P=Data.NoPeaks{j}{p}*2; NoPeaks= Data.NoPeaks{j}{p}; [x,y] = ginput(P); Data.x{j}{p}=[x]; Data.y{j}{p}=[y]; point=[x,y]; %close (f); % for m=1:2:P-1 %here we determine the interval of THE peak; the initial value %will determine the basal level m=1;%only one response! myIndices1=find(frame>=x(m));%for each of the secondaries myIndices2=find(frame<=x(m+1));%for each of the secondaries frame2=frame(myIndices1(1):myIndices2(end));%frame effective piece Data.PeakFrames{j}{p}=frame2%from the fple j, the cell i, the peak m Data.PeakInt{j}{p}=Data.UnbPrimaryCellS{j}{p}(myIndices1(1):myIndices2(end)); %intensity effective piece, the response will start at zero SAVE! figure() plot(Data.PeakInt{j}{p},'k') hold; %close (gcf); [maxintens,index1] =max(Data.PeakInt{j}{p}); Data.PeakAmpl{j}{p}=max(Data.PeakInt{j}{p})-Data.PeakInt{j}{p}(1);%amplitude, measured from the the point of the response at y(1) [NoPeaks] Data.PeakHalfMax{j}{p}=Data.PeakAmpl{j}{p}/2; %save the Peak Half Max, now that we know it exists. plot(frame(index1),Data.PeakInt{j}{p},'r.')%plots the peak intensity %now we have to measure the duration!!!, WE'LL SEE HOW IT %WORKS FOR THE RESPONSES WHICH STAY UP! %Before: A intensA=Data.PeakInt{j}{p}(1:index1)-Data.PeakInt{j}{p}(1);%the portion before the maximum % [halfmaxA,index2]=max(intensA)/2; index2=find(intensA<=Data.PeakHalfMax{j}{p});%antes del halfmax frameA{j}{p}=frame(index2); Data.HalfMaxFrameA{j}{p}=frameA{j}{p}(end); %save! plot(Data.HalfMaxFrameA{j}{p},Data.PeakInt{j}{p},'b.') %After: D intensD=Data.PeakInt{j}{p}(index1:end)-Data.PeakInt{j}{p}(1);%the portion after the maximum, translated the same amount as intensA index3=find(intensD>=Data.PeakHalfMax{j}{p});%antes del halfmax frameD{j}{p}=frame(index1+index3); Data.HalfMaxFrameD{j}{p}=frameD{j}{p}(end);%save! plot(Data.HalfMaxFrameD{j}{p},Data.PeakInt{j}{p},'b.') %%% SAVE THE NEXT THREE IN THE PROPER CASE!!!! Data.FrameDuration{j}{p}=Data.HalfMaxFrameD{j}{p}-Data.HalfMaxFrameA{j}{p};%duration of avg amplitude Data.TimeDuration{j}{p}= (Data.FrameDuration{j}{p}).*Data.TimePerFrame;%duration of avg amplitude Data.Amount{j}{p}=Data.PeakAmpl{j}{p}*Data.TimeDuration{j}{p}; fileN=[files.name(1:end-4) '_Cell_' num2str(p)] SaveAllFigures(fileN,'fig'); Alphabet={'A','B','C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P','Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA','AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ'}; %save the linear combination vector and the coefficients the coefficients NoResp=numel(Secondary1);%the number of responses! myName=[]; myName{1}=['LCCoeffs']; myName{1+NoResp}=['LC_Vector']; myName{1+(2*NoResp)}=['LC_Exp']; %myName{4}=['Unb_Local']; headers = [myName]; letter1=[Alphabet(NoCells+(3))]; CoeffPosition1A=[letter1 '1']; CoeffPosition1=strcat(CoeffPosition1A(1), CoeffPosition1A(2)); varargin=CoeffPosition1; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, headers,p*2,myString); CoeffPosition2A=[letter1 '2']; CoeffPosition2=strcat(CoeffPosition2A(1), CoeffPosition2A(2)); varargin=CoeffPosition2; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, Data.CoeffVec{j}{p},p*2,myString); Data.PrimaryLinearComb{j}{p}=Data.Cell{j}{p}{NoCells+2}; letter2=[Alphabet(NoCells+(3+(NoResp)))]; LinearCombPositionA=[letter2 '2']; LinearCombPosition=strcat(LinearCombPositionA(1), LinearCombPositionA(2)); varargin=LinearCombPosition; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, Data.PrimaryLinearComb{j}{p},p*2,myString); letter3=[Alphabet(NoCells+(3+(NoResp*2)))]; UnbExpPositionA=[letter3 '2']; UnbExpPosition=strcat(UnbExpPositionA(1), UnbExpPositionA(2)); varargin=UnbExpPosition; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, Data.LinearCombinationS{j}{p}{1},p*2,myString); myName1{1}=['Noise in Primary and Secondaries']; headers1 = [myName1]; L1=[Alphabet(2*NoCells +2)]; NoisePosition1A=[L1 '3']; NoisePosition1=strcat(NoisePosition1A(1), NoisePosition1A(2)); varargin=NoisePosition1; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, headers1,p*2-1,myString); NoisePosition2A=[L1 '4']; NoisePosition2=strcat(NoisePosition2A(1), NoisePosition2A(2)); varargin=NoisePosition2; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, Data.Noise{j}{p},p*2-1,myString); % SAVING THE ORIGINAL EXPONENTIAL FIT FOR ALL THE CELLS NameExp{1}=['a*exp(-t/b)']; NameExp{2}=['a']; NameExp{3}=['b']; letter1=[Alphabet(NoCells+(3+(NoResp*3)+2))]; %THE HEADER CoeffPosition1A=[letter1 '1']; CoeffPosition1=strcat(CoeffPosition1A(1), CoeffPosition1A(2)); varargin=CoeffPosition1; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, NameExp',p*2,myString); for k=2:NoCells+1 myCell{k}=['Cell' num2str(k)]; ExpFitCell_1{k} =[Data.s{j}{p}{k}(2)]; ExpFitCell_2{k} =[Data.s{j}{p}{k}(3)]; end headerCELL= [myCell]'; letter1=[Alphabet(NoCells+(3+(NoResp*3)+2))]; %THE HEADER CoeffPosition1A=[letter1 '1']; CoeffPosition1=strcat(CoeffPosition1A(1), CoeffPosition1A(2)); varargin=CoeffPosition1; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, headerCELL',p*2,myString); % A COEFFICIENT FROM THE EXPONENTIAL FIT CoeffPosition2A=[letter1 '2']; CoeffPosition2=strcat(CoeffPosition2A(1), CoeffPosition2A(2)); varargin=CoeffPosition2; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, ExpFitCell_1,p*2,myString); %b MEAN TIME OF THE EXPONENTIAL FIT CoeffPosition3A=[letter1 '3']; CoeffPosition3=strcat(CoeffPosition3A(1), CoeffPosition3A(2)); varargin=CoeffPosition3; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, ExpFitCell_2,p*2,myString); %SAVING THE ANALYSIS OF THE AMOUNT OF Ca finalExpLetter=Alphabet(((NoCells+1)*2+2)); NoPeaks=numel (Secondary)+1; myPeak=[]; for l= 1:NoPeaks myPeak{2*l-1}=['Response_' num2str(l) 't_i']; myPeak{2*l}=['Response_' num2str(l) 't_f']; end headerPeak = [myPeak]'; PeakPositionHA=[Alphabet((NoCells+1)*2+4) '7']; PeakPositionH=strcat(PeakPositionHA(1), PeakPositionHA(2)); varargin=PeakPositionH; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, headerPeak,p*2-1,myString); myPeakH{1}=['Frame']; myPeakH{2}=['Time']; myPeakH{3}=['Intensity i/f']; myPeakH{4}=['Frame duration']; myPeakH{5}=['Time duration']; myPeakH{6}=['Amplitude']; myPeakH{7}=['Amount']; myPeakH{8}=['Cell_Response']; PeakHeader= [myPeakH]; PeakHPosA=[Alphabet((NoCells+1)*2+5) '6']; PeakHPos=strcat(PeakHPosA(1), PeakHPosA(2)); varargin=PeakHPos; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, PeakHeader ,(p*2)-1,myString); xPeakPosition= [Data.x{j}{p}]; yPeakPosition=[Data.y{j}{p}]; PeakFrameDuration =[Data.FrameDuration{j}{p}]; PeakTimeDuration= [ Data.TimeDuration{j}{p}]; PeakAmpl=[Data.PeakAmpl{j}{p}]; PeakAmount= [Data.Amount{j}{p}]; % Frame Begining and end of the peak PeakTimePositionA=[Alphabet((NoCells+1)*2+5) '7']; PeakTimePosition=strcat(PeakTimePositionA(1), PeakTimePositionA(2)); varargin=PeakTimePosition; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, xPeakPosition,p*2-1,myString);%Data.x{j}{p} % Temporal Begining and end of the peak PeakTimePositionA=[Alphabet((NoCells+1)*2+6) '7']; PeakTimePosition=strcat(PeakTimePositionA(1), PeakTimePositionA(2)); varargin=PeakTimePosition; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, xPeakPosition*0.345,p*2-1,myString);%Data.x{j}{p} % Intensity at the x chosen point PeakTimePositionA=[Alphabet((NoCells+1)*2+7) '7']; PeakTimePosition=strcat(PeakTimePositionA(1), PeakTimePositionA(2)); varargin=PeakTimePosition; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, yPeakPosition,p*2-1,myString);%Data.y{j}{p} % Response Frame Duration FrameDurationPositionA=[Alphabet((NoCells+1)*2+8) '7']; FrameDurationPosition=strcat(FrameDurationPositionA(1), FrameDurationPositionA(2)); varargin=FrameDurationPosition; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, PeakFrameDuration' ,p*2-1,myString); % Response Time Duration TimeDurationPositionA=[Alphabet((NoCells+1)*2+9) '7']; TimeDurationPosition=strcat(TimeDurationPositionA(1), TimeDurationPositionA(2)); varargin=TimeDurationPosition; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, PeakTimeDuration' ,p*2-1,myString); % Amplitude AmplitudePositionA=[Alphabet((NoCells+1)*2+10) '7']; AmplitudePosition=strcat(AmplitudePositionA(1), AmplitudePositionA(2)); varargin=AmplitudePosition; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, PeakAmpl' ,p*2-1,myString); % Amount AmountPositionA=[Alphabet((NoCells+1)*2+11) '7']; AmountPosition=strcat(AmountPositionA(1), AmountPositionA(2)); varargin=AmountPosition; myString = ''; for i=1:length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end xlswrite(files.name, PeakAmount' ,p*2-1,myString); % Secondary1 ResponsePositionA=[Alphabet((NoCells+1)*2+12) '7']; ResponsePosition=strcat(ResponsePositionA(1), ResponsePositionA(2)); varargin=ResponsePosition; myString = ''; for i=1:1%length(varargin) if isnumeric(varargin{i}) myString = [myString num2str(varargin{i}) ',']; else myString = [myString varargin{i} ',']; end end S=Secondary1(1)';%S=Secondary1'; xlswrite(files.name, S ,p*2-1,myString); else end end close all; end %now we need to choose where the force curve is done in the movie, which curve to choose and which frames shall we take for the force curves