function [timings] = getTimings(subjdata,sesn) if nargin < 2 if nargin< 1 error('Provide subject data.'); end sesn='all'; end if strcmpi(sesn,'all') sesn=1:length(subjdata); end catoffer1=[]; catdelay1=[]; catoffer2=[]; catdelay2=[]; catfxdotm=[]; catchgotm=[]; catfbcktm=[]; catsacctm=[]; catchmade=[]; for sn=sesn for tr=1:length(subjdata{sn}.timings) curroff1ref=round(subjdata{sn}.timings(tr).appearOffer1Time); catoffer1=cat(1,catoffer1,3000); catdelay1=cat(1,catdelay1,round(subjdata{sn}.timings(tr).disappearOffer1Time)-curroff1ref+3000); catoffer2=cat(1,catoffer2,round(subjdata{sn}.timings(tr).appearOffer2Time)-curroff1ref+3000); catdelay2=cat(1,catdelay2,round(subjdata{sn}.timings(tr).disappearOffer2Time)-curroff1ref+3000); catfxdotm=cat(1,catfxdotm,round(subjdata{sn}.timings(tr).fixStartFixnDotTime)-curroff1ref+3000); catchgotm=cat(1,catchgotm,round(subjdata{sn}.timings(tr).choiceGoTime)-curroff1ref+3000); catfbcktm=cat(1,catfbcktm,round(subjdata{sn}.timings(tr).feedbackTime)-curroff1ref+3000); catsacctm=cat(1,catsacctm,round(min([subjdata{sn}.timings(tr).fixStartLeftOfferTime subjdata{sn}.timings(tr).fixStartRightOfferTime]))-curroff1ref+3000); catchmade=cat(1,catchmade,round(subjdata{sn}.timings(tr).choiceMadeTime)-curroff1ref+3000); end end timings.preoffer1=zeros(length(catoffer1),1); timings.offer1=catoffer1; timings.delay1=catdelay1; timings.offer2=catoffer2; timings.delay2=catdelay2; timings.stfxndot=catfxdotm; timings.choicego=catchgotm; timings.fchsacc=catsacctm; timings.chemade=catchmade; timings.fdbck=catfbcktm; end