getTimewinsPoolEyePos.m 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. function pooltweyepos=getTimewinsPoolEyePos(poolstackvars,poolstackepos)
  2. opts = struct('WindowStyle','modal','Interpreter','none','Default','No');
  3. answer = questdlg('This requires memory at runtime. Are you sure to continue?','Memory Warning','Yes','No',opts);
  4. if strcmpi(answer,'No'); error('Aborted getting pool stack eye position (consider cleaning workspace).'); end
  5. if nargin<2
  6. subjsData(1).sbdata=getSubjectData(1);
  7. subjsData(2).sbdata=getSubjectData(2);
  8. poolstackepos=getPoolStackEyePos(subjsData);
  9. if nargin<1
  10. poolstackvars=getPoolStackVars(subjsData);
  11. end
  12. end
  13. Nsns=size(poolstackepos,1);
  14. Ntws=size(poolstackepos,2);
  15. Ncells=arrayfun(@(sn) poolstackvars(sn).ncells, 1:Nsns);
  16. Ntrs=arrayfun(@(sn) size(poolstackvars(sn).offer1sd,1),1:Nsns);
  17. Ntrs12=max(Ntrs);
  18. Ntps=[400 arrayfun(@(tw) max(arrayfun(@(sn) size(poolstackepos(sn,tw).eyePosX,2), 1:Nsns)),2:Ntws)];
  19. pooltweyepos(Ntws).posX=[];
  20. pooltweyepos(Ntws).posY=[];
  21. for sn=1:Nsns
  22. for tw=1:Ntws
  23. % re-reference to 1st offer = L
  24. if tw==1
  25. curreposx=poolstackepos(sn,tw).eyePosX(:,end-400+1:end);
  26. curreposy=poolstackepos(sn,tw).eyePosY(:,end-400+1:end);
  27. else
  28. curreposx=poolstackepos(sn,tw).eyePosX;
  29. curreposy=poolstackepos(sn,tw).eyePosY;
  30. end
  31. % is1stL=find(poolstackvars(sn).offer1sd==1);
  32. is1stR=find(poolstackvars(sn).offer1sd==0);
  33. curreposx(is1stR,:)=-curreposx(is1stR,:);
  34. [currntrs, currntps]=size(curreposx);
  35. pooltweyepos(tw).posX= cat(2, pooltweyepos(tw).posX, cat(1, cat(3, repmat(reshape(curreposx,[currntrs 1 currntps]),[1 Ncells(sn) 1]),...
  36. nan(Ntrs(sn),Ncells(sn),Ntps(tw)-currntps)), nan(Ntrs12-Ntrs(sn),Ncells(sn),Ntps(tw))));
  37. pooltweyepos(tw).posY= cat(2, pooltweyepos(tw).posY, cat(1, cat(3, repmat(reshape(curreposy,[currntrs 1 currntps]),[1 Ncells(sn) 1]),...
  38. nan(Ntrs(sn),Ncells(sn),Ntps(tw)-currntps)), nan(Ntrs12-Ntrs(sn),Ncells(sn),Ntps(tw))));
  39. end
  40. end
  41. end