getTimings.m 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. function [timings] = getTimings(subjdata,sesn)
  2. if nargin < 2
  3. if nargin< 1
  4. error('Provide subject data.');
  5. end
  6. sesn='all';
  7. end
  8. if strcmpi(sesn,'all')
  9. sesn=1:length(subjdata);
  10. end
  11. catoffer1=[]; catdelay1=[]; catoffer2=[]; catdelay2=[];
  12. catfxdotm=[]; catchgotm=[]; catfbcktm=[]; catsacctm=[]; catchmade=[];
  13. for sn=sesn
  14. for tr=1:length(subjdata{sn}.timings)
  15. curroff1ref=round(subjdata{sn}.timings(tr).appearOffer1Time);
  16. catoffer1=cat(1,catoffer1,3000);
  17. catdelay1=cat(1,catdelay1,round(subjdata{sn}.timings(tr).disappearOffer1Time)-curroff1ref+3000);
  18. catoffer2=cat(1,catoffer2,round(subjdata{sn}.timings(tr).appearOffer2Time)-curroff1ref+3000);
  19. catdelay2=cat(1,catdelay2,round(subjdata{sn}.timings(tr).disappearOffer2Time)-curroff1ref+3000);
  20. catfxdotm=cat(1,catfxdotm,round(subjdata{sn}.timings(tr).fixStartFixnDotTime)-curroff1ref+3000);
  21. catchgotm=cat(1,catchgotm,round(subjdata{sn}.timings(tr).choiceGoTime)-curroff1ref+3000);
  22. catfbcktm=cat(1,catfbcktm,round(subjdata{sn}.timings(tr).feedbackTime)-curroff1ref+3000);
  23. catsacctm=cat(1,catsacctm,round(min([subjdata{sn}.timings(tr).fixStartLeftOfferTime subjdata{sn}.timings(tr).fixStartRightOfferTime]))-curroff1ref+3000);
  24. catchmade=cat(1,catchmade,round(subjdata{sn}.timings(tr).choiceMadeTime)-curroff1ref+3000);
  25. end
  26. end
  27. timings.preoffer1=zeros(length(catoffer1),1);
  28. timings.offer1=catoffer1;
  29. timings.delay1=catdelay1;
  30. timings.offer2=catoffer2;
  31. timings.delay2=catdelay2;
  32. timings.stfxndot=catfxdotm;
  33. timings.choicego=catchgotm;
  34. timings.fchsacc=catsacctm;
  35. timings.chemade=catchmade;
  36. timings.fdbck=catfbcktm;
  37. end