%% % Just for revisions %% CONFLICT CONGRUENT BigN=size(MEGA_ERP_minsize,1); tx=-2000:2:1998; t1=find(tx==-500); t2=find(tx==1000); tx2disp=-500:2:1000; P2=200; P2range=10; % in ms N2=275; N2range=20; P3=450; P3range=150; LATE=700; LATErange=250; figure; subplot(4,1,1); hold on plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,19,t1:t2,[2,4,6,8]),4),1)),'r','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,19,t1:t2,[1,3,5,7]),4),1)),'b','linewidth',2); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,19,t1:t2,[2,4,6,8]),4),1)),squeeze(std(mean(MEGA_ERP_minsize(:,19,t1:t2,[2,4,6,8]),4),1))./sqrt(BigN),'r'); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,19,t1:t2,[1,3,5,7]),4),1)),squeeze(std(mean(MEGA_ERP_minsize(:,19,t1:t2,[1,3,5,7]),4),1))./sqrt(BigN),'b'); plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,19,t1:t2,[2,4,6,8]),4),1)),'r','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,19,t1:t2,[1,3,5,7]),4),1)),'b','linewidth',2); plot(mean(mean(RT(:,[2,4,6,8]))),[10],'ro'); plot(mean(mean(RT(:,[1,3,5,7]))),[10],'bo'); plot([0 0],[-5 15],'k:'); plot([-500 1000],[0 0],'k:'); %plot([P2 P2],[-5 15],'m'); plot([P2-10 P2-10],[-5 15],'c'); plot([P2+10 P2+10],[-5 15],'c'); text(P2,-5,'P2'); plot([N2 N2],[-5 15],'m'); plot([N2-20 N2-20],[-5 15],'c'); plot([N2+20 N2+20],[-5 15],'c'); text(N2,-5,'N2'); title('FCz') legend({'CONFLICT','CONGRUENT'}) subplot(4,1,2); hold on shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,28,t1:t2,[2,4,6,8]),4),1)),squeeze(std(mean(MEGA_ERP_minsize(:,28,t1:t2,[2,4,6,8]),4),1))./sqrt(BigN),'r'); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,28,t1:t2,[1,3,5,7]),4),1)),squeeze(std(mean(MEGA_ERP_minsize(:,28,t1:t2,[1,3,5,7]),4),1))./sqrt(BigN),'b'); plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,28,t1:t2,[2,4,6,8]),4),1)),'r','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,28,t1:t2,[1,3,5,7]),4),1)),'b','linewidth',2); plot(mean(mean(RT(:,[2,4,6,8]))),[10],'ro'); plot(mean(mean(RT(:,[1,3,5,7]))),[10],'bo'); plot([0 0],[-5 15],'k:'); plot([-500 1000],[0 0],'k:'); %plot([P2 P2],[-5 15],'m'); plot([P2-10 P2-10],[-5 15],'c'); plot([P2+10 P2+10],[-5 15],'c'); text(P2,-5,'P2'); %plot([N2 N2],[-5 15],'m'); plot([N2-20 N2-20],[-5 15],'c'); plot([N2+20 N2+20],[-5 15],'c'); text(N2,-5,'N2'); plot([P3 P3],[-5 15],'m'); plot([P3-P3range P3-P3range],[-5 15],'c'); plot([P3+P3range P3+P3range],[-5 15],'c'); text(P3,-5,'P3'); title('Cz') subplot(4,1,3); hold on shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,46,t1:t2,[2,4,6,8]),4),1)),squeeze(std(mean(MEGA_ERP_minsize(:,46,t1:t2,[2,4,6,8]),4),1))./sqrt(BigN),'r'); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,46,t1:t2,[1,3,5,7]),4),1)),squeeze(std(mean(MEGA_ERP_minsize(:,46,t1:t2,[1,3,5,7]),4),1))./sqrt(BigN),'b'); plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,46,t1:t2,[2,4,6,8]),4),1)),'r','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,46,t1:t2,[1,3,5,7]),4),1)),'b','linewidth',2); plot(mean(mean(RT(:,[2,4,6,8]))),[10],'ro'); plot(mean(mean(RT(:,[1,3,5,7]))),[10],'bo'); plot([0 0],[-5 15],'k:'); plot([-500 1000],[0 0],'k:'); plot([P3 P3],[-5 15],'m'); plot([P3-P3range P3-P3range],[-5 15],'c'); plot([P3+P3range P3+P3range],[-5 15],'c'); text(P3,-5,'P3'); plot([LATE LATE],[-5 15],'m'); plot([LATE-LATErange LATE-LATErange],[-5 15],'c'); plot([LATE+LATErange LATE+LATErange],[-5 15],'c'); text(LATE,-5,'LATE'); title('Pz') subplot(4,1,4); hold on tx=-2000:2:1998; LRP_t1=find(tx==-1000); LRP_t2=find(tx==500); LRP_tx2disp=-1000:2:500; shadedErrorBar(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_LRP_minsize(:,LRP_t1:LRP_t2,[2,4,6,8]),3),1)),squeeze(std(mean(MEGA_ERP_LRP_minsize(:,LRP_t1:LRP_t2,[2,4,6,8]),3),1))./sqrt(BigN),'r'); shadedErrorBar(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_LRP_minsize(:,LRP_t1:LRP_t2,[1,3,5,7]),3),1)),squeeze(std(mean(MEGA_ERP_LRP_minsize(:,LRP_t1:LRP_t2,[1,3,5,7]),3),1))./sqrt(BigN),'b'); plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_LRP_minsize(:,LRP_t1:LRP_t2,[2,4,6,8]),3),1)),'r','linewidth',2); plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_LRP_minsize(:,LRP_t1:LRP_t2,[1,3,5,7]),3),1)),'b','linewidth',2); plot([0 0],[-4 4],'k:'); plot([-1000 500],[0 0],'k:'); plot([-300 -300],[-2 2],'c'); plot([-150 -150],[-2 2],'c'); plot([-150 -150],[-2 2],'c'); plot([-50 -50],[-2 2],'c'); title('LRP') %% REPEAT vs. SWITCH figure; site=19; subplot(4,1,1); hold on plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,site,t1:t2,1:4),4),1)),'k','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,site,t1:t2,5:8),4),1)),'g','linewidth',2); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,site,t1:t2,1:4),4),1)),squeeze(std(mean(MEGA_ERP_minsize(:,site,t1:t2,1:4),4),1))./sqrt(BigN),'k'); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,site,t1:t2,5:8),4),1)),squeeze(std(mean(MEGA_ERP_minsize(:,site,t1:t2,5:8),4),1))./sqrt(BigN),'g'); plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,site,t1:t2,1:4),4),1)),'k','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,site,t1:t2,5:8),4),1)),'g','linewidth',2); plot(mean(mean(RT(:,1:4))),[10],'ko'); plot(mean(mean(RT(:,5:8))),[10],'go'); plot([0 0],[-5 15],'k:'); plot([-500 1000],[0 0],'k:'); % plot([P2 P2],[-5 15],'m'); plot([P2-10 P2-10],[-5 15],'c'); plot([P2+10 P2+10],[-5 15],'c'); text(P2,-5,'P2'); plot([N2 N2],[-5 15],'m'); plot([N2-20 N2-20],[-5 15],'c'); plot([N2+20 N2+20],[-5 15],'c'); text(N2,-5,'N2'); title('FCz') legend({'REPEAT','SWITCH'}) subplot(4,1,2); hold on site=28; shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,site,t1:t2,1:4),4),1)),squeeze(std(mean(MEGA_ERP_minsize(:,site,t1:t2,1:4),4),1))./sqrt(BigN),'k'); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,site,t1:t2,5:8),4),1)),squeeze(std(mean(MEGA_ERP_minsize(:,site,t1:t2,5:8),4),1))./sqrt(BigN),'g'); plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,site,t1:t2,1:4),4),1)),'k','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,site,t1:t2,5:8),4),1)),'g','linewidth',2); plot(mean(mean(RT(:,1:4))),[10],'ko'); plot(mean(mean(RT(:,5:8))),[10],'go'); plot([0 0],[-5 15],'k:'); plot([-500 1000],[0 0],'k:'); %plot([P2 P2],[-5 15],'m'); plot([P2-10 P2-10],[-5 15],'c'); plot([P2+10 P2+10],[-5 15],'c'); text(P2,-5,'P2'); %plot([N2 N2],[-5 15],'m'); plot([N2-20 N2-20],[-5 15],'c'); plot([N2+20 N2+20],[-5 15],'c'); text(N2,-5,'N2'); plot([P3 P3],[-5 15],'m'); plot([P3-P3range P3-P3range],[-5 15],'c'); plot([P3+P3range P3+P3range],[-5 15],'c'); text(P3,-5,'P3'); title('Cz') subplot(4,1,3); hold on site=46; shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,site,t1:t2,1:4),4),1)),squeeze(std(mean(MEGA_ERP_minsize(:,site,t1:t2,1:4),4),1))./sqrt(BigN),'k'); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,site,t1:t2,5:8),4),1)),squeeze(std(mean(MEGA_ERP_minsize(:,site,t1:t2,5:8),4),1))./sqrt(BigN),'g'); plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,site,t1:t2,1:4),4),1)),'k','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP_minsize(:,site,t1:t2,5:8),4),1)),'g','linewidth',2); plot(mean(mean(RT(:,1:4))),[10],'ko'); plot(mean(mean(RT(:,5:8))),[10],'go'); plot([0 0],[-5 15],'k:'); plot([-500 1000],[0 0],'k:'); plot([P3 P3],[-5 15],'m'); plot([P3-P3range P3-P3range],[-5 15],'c'); plot([P3+P3range P3+P3range],[-5 15],'c'); text(P3,-5,'P3'); plot([LATE LATE],[-5 15],'m'); plot([LATE-LATErange LATE-LATErange],[-5 15],'c'); plot([LATE+LATErange LATE+LATErange],[-5 15],'c'); text(LATE,-5,'LATE'); title('Pz') subplot(4,1,4); hold on tx=-2000:2:1998; LRP_t1=find(tx==-1000); LRP_t2=find(tx==500); LRP_tx2disp=-1000:2:500; shadedErrorBar(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_LRP_minsize(:,LRP_t1:LRP_t2,1:4),3),1)),squeeze(std(mean(MEGA_ERP_LRP_minsize(:,LRP_t1:LRP_t2,1:4),3),1))./sqrt(BigN),'k'); shadedErrorBar(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_LRP_minsize(:,LRP_t1:LRP_t2,5:8),3),1)),squeeze(std(mean(MEGA_ERP_LRP_minsize(:,LRP_t1:LRP_t2,5:8),3),1))./sqrt(BigN),'g'); plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_LRP_minsize(:,LRP_t1:LRP_t2,1:4),3),1)),'k','linewidth',2); plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_LRP_minsize(:,LRP_t1:LRP_t2,5:8),3),1)),'g','linewidth',2); plot([0 0],[-4 4],'k:'); plot([-1000 500],[0 0],'k:'); plot([-300 -300],[-2 2],'c'); plot([-150 -150],[-2 2],'c'); plot([-150 -150],[-2 2],'c'); plot([-50 -50],[-2 2],'c'); title('LRP') %% Get ROIs SITE=[19,28,46]; for ai=1:3 % SITE=[FCz,Cz,Pz] for bi=1:4 % TIMES=[P2,N2,P3,LATE]; for ci=1:8 MEANS(:,ai,bi,ci)=squeeze(mean(MEGA_ERP_minsize(:,SITE(ai),TIMEWINS{bi},ci),3)); end end end TIMEWINS_LAT=find(tx==P3)-(P3range/2):find(tx==P3)+(P3range/2) ; % 300 to 600 P3actuallatency=P3-P3range:2:P3+P3range; for si=1:size(MEGA_ERP_minsize,1) for ai=1:3 % SITE=[FCz,Cz,Pz] for ci=1:8 idx=find(squeeze(MEGA_ERP_minsize(si,SITE(ai),TIMEWINS_LAT,ci))==max(squeeze(MEGA_ERP_minsize(si,SITE(ai),TIMEWINS_LAT,ci)))); P3Latency(si,ai,ci)=P3actuallatency(idx); end end end %% % % % % % Major cue-locked components were defined as the mean activity over the following windows and electrodes: % % % % N2 (FCz: 275 +/- 20 ms), % % % % P3 (Pz: 450 +/- 150 ms), % % % % Slow wave (Pz, 700 +/- 250 ms), % % % % additionally P3 peak times were quantified at the P3 window and electrode. % % % % Response-locked LRP components were defined as the pre-LRP (-300 to -150 ms) and the LRP slope (-50 ms minus -150 ms). clear ERPmean; CHAN=3 ;% SITE=[FCz,Cz,Pz] TIME=4 ;% TIMES=[P2,N2,P3,LATE]; ERPmean=squeeze(mean(MEANS(:,CHAN,TIME,:),2)); % -squeeze(MEANS(:,CHAN,2,:)); % % ERPmean=squeeze(mean(P3Latency(:,3,:),2)); %% clear ERPmean; lrp1=find(tx==-300); lrp2=find(tx==-150); lrp3=find(tx==-50); % ERPmean=-1* (squeeze(mean(MEGA_ERP_LRP_minsize(:,lrp3,:),2))-squeeze(mean(MEGA_ERP_LRP_minsize(:,lrp2,:),2)) ); LRP_TITLE='LRP SLOPE'; ERPmean=squeeze(mean(MEGA_ERP_LRP_minsize(:,lrp1:lrp2,:),2)); LRP_TITLE='PRE-LRP';