%% Step 3 - View ERPs clear all; clc addpath('Z:\EXPERIMENTS\Flankers t2t\'); datalocation='Y:\EEG_Data\Flankers OCDII\ERPs\'; % Data are here cd(datalocation); load('Z:\EXPERIMENTS\Flankers t2t\NScan_Chanlocs_60.mat'); FILZ=dir('*_ERPs_2018_Revision_withErrors.mat'); sidx=1; for si=1:length(FILZ) load(FILZ(si).name); load(['Y:\EEG_Data\Flankers OCDII\Processed Data\',num2str(FILZ(si).name(1:3)),'_BEH_VECTOR.mat'],'BEH_VECTOR'); if SUBJINFO(6)<=21 MEGA_ERP(sidx,:,:,:)=ERP; MEGA_ERP_RESP(sidx,:,:)=ERP_RESP; MEGA_ERP_RESP_All(sidx,:,:,:)=ERP_RESP_All; MEGA_SUBJINFO(sidx,:)=SUBJINFO; BEH{sidx}=VECTOR; BEH_WithErrors{sidx}=BEH_VECTOR; for tfi=1:2 MEGA_PWR{tfi}(sidx,:,:,:)=POWER{tfi}; MEGA_PHS{tfi}(sidx,:,:,:)=ITPC{tfi}; end % From revision MEGA_ERP_minsize(sidx,:,:,:)=ERP_minsize; % Same as ERPs, but limited to min trial ct size MEGA_ERP_LRP_minsize(sidx,:,:,:)=ERP_LRP_minsize; % Same as ERP LRPs, but limited to min trial ct size % ^^^^^^^^ MEGA_ERP_LRP_to_STIM(sidx,:,:)=ERP_LRP_to_STIM; % Same as LRP, but stim-locked % ^^^^^^^^ MEGA_ERP_Corr(sidx,:,:,:)=ERP_Corr; % single trial RT corr MEGA_ERP_RESP_Corr(sidx,:,:)=ERP_RESP_Corr; % single trial RT corr - LRP sidx=sidx+1; end clear SUBJINFO SUBJINFO_HDR VECTOR BEH_VECTOR POWER ITPC ERP_RESP_All BEH_VECTOR; clear ERP_LRP_to_STIM ERP_minsize ERP_Corr ERP_RESP_Corr end %% ACCURACY for si=1:23 VECTOR=BEH_WithErrors{si}; VECTOR(VECTOR(:,7)==1,[3,6])=NaN; % No blockstarts VECTOR(VECTOR(:,5)<200,[3,6])=NaN; % If RT<200 or NaN, then NaN the row VECTOR(isnan(VECTOR(:,5)),[3,6])=NaN; VECTOR(:,9)=[99;VECTOR(1:end-1,3)]; % prev congru VECTOR(:,10)=[99;VECTOR(1:end-1,4)]; % prev RightLeft for ai=1:length(VECTOR) if ~isnan(VECTOR(ai,3)) GRATTON=NaN; RESPS=NaN; % ---------------------- congruent (1) or conflict (0) if VECTOR(ai,9)==1 && VECTOR(ai,3)==1, GRATTON=1; % cC elseif VECTOR(ai,9)==1 && VECTOR(ai,3)==0, GRATTON=2; % cI elseif VECTOR(ai,9)==0 && VECTOR(ai,3)==1, GRATTON=3; % iC elseif VECTOR(ai,9)==0 && VECTOR(ai,3)==0, GRATTON=4; % iI end % ---------------------- [Right=1, Left=2] if VECTOR(ai,10)==1 && VECTOR(ai,4)==1, RESPS=1; % rR elseif VECTOR(ai,10)==2 && VECTOR(ai,4)==2, RESPS=1; % lL elseif VECTOR(ai,10)==1 && VECTOR(ai,4)==2, RESPS=10; % rL elseif VECTOR(ai,10)==2 && VECTOR(ai,4)==1, RESPS=10; % lR end % ---------------------- VECTOR(ai,14)=GRATTON; VECTOR(ai,15)=RESPS; VECTOR(ai,16)=GRATTON.*RESPS; clear GRATTON RESPS else % ---------------------- VECTOR(ai,14)=NaN; VECTOR(ai,15)=NaN; VECTOR(ai,16)=NaN; end end BEH_WithErrors{si}=VECTOR; end thecondis={'REPEAT cC','REPEAT cI','REPEAT iC','REPEAT iI','Change cC','Change cI','Change iC','Change iI'}; CONDIS=[5,6,7,8,1,2,3,4]; PANEL=[1,1,2,2,4,4,5,5]; COLOR={'bo','ro','bo','ro','bo','ro','bo','ro'}; for si=1:length(BEH_WithErrors) VECTOR=BEH_WithErrors{si}; UNIQUES=unique(VECTOR(:,16)); UNIQUES=UNIQUES(UNIQUES>0); for ai=1:8 Acc(si,ai)=nanmean(VECTOR(VECTOR(:,16)==UNIQUES(ai),6)); end clear VECTOR; end figure; hold on plot(1,mean(Acc(:,CONDIS(1))),COLOR{1}); plot(1,mean(Acc(:,CONDIS(2))),COLOR{2}); legend({'CONG','INCONG'},'Location','NorthWest') for condi=1:8 plot(PANEL(condi),mean(Acc(:,CONDIS(condi))),COLOR{condi}); errorbar(PANEL(condi),mean(Acc(:,CONDIS(condi))),std(Acc(:,CONDIS(condi)))/sqrt(size(Acc,1)),'k.'); end plot([1 2],[mean(Acc(:,CONDIS(1))) mean(Acc(:,CONDIS(3)))],'k-'); plot([1 2],[mean(Acc(:,CONDIS(2))) mean(Acc(:,CONDIS(4)))],'k-'); plot([4 5],[mean(Acc(:,CONDIS(5))) mean(Acc(:,CONDIS(7)))],'k-'); plot([4 5],[mean(Acc(:,CONDIS(6))) mean(Acc(:,CONDIS(8)))],'k-'); ylabel('%'); set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'}); title('Acc'); Acc=1-Acc; figure; hold on plot(1,mean(Acc(:,CONDIS(1))),COLOR{1}); plot(1,mean(Acc(:,CONDIS(2))),COLOR{2}); legend({'CONG','INCONG'},'Location','NorthWest') for condi=1:8 plot(PANEL(condi),mean(Acc(:,CONDIS(condi))),COLOR{condi}); errorbar(PANEL(condi),mean(Acc(:,CONDIS(condi))),std(Acc(:,CONDIS(condi)))/sqrt(size(Acc,1)),'k.'); end plot([1 2],[mean(Acc(:,CONDIS(1))) mean(Acc(:,CONDIS(3)))],'k-'); plot([1 2],[mean(Acc(:,CONDIS(2))) mean(Acc(:,CONDIS(4)))],'k-'); plot([4 5],[mean(Acc(:,CONDIS(5))) mean(Acc(:,CONDIS(7)))],'k-'); plot([4 5],[mean(Acc(:,CONDIS(6))) mean(Acc(:,CONDIS(8)))],'k-'); ylabel('err'); set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'}); title('Error Rate'); %% Do Beh for si=1:length(BEH) VECTOR=BEH{si}; UNIQUES=unique(VECTOR(:,16)); UNIQUES=UNIQUES(UNIQUES>0); % % % ---------------- limit based on lowest epoch count % ---------------- % ---------------- % % for ai=1:8 % % TEMP_by_set{ai}=VECTOR(VECTOR(:,16)==UNIQUES(ai),:); % % TEMP_by_set_SIZE(ai)=size(TEMP_by_set{ai},1); % % end % % TEMP_minsize=min(TEMP_by_set_SIZE); % % % ---- % % for ai=1:8 % % TEMP_TRIALS=1:TEMP_by_set_SIZE(ai); % % TEMP_TRIALS=shuffle(TEMP_TRIALS); % % RT(si,ai)=squeeze(nanmean( TEMP_by_set{ai}(TEMP_TRIALS(1:TEMP_minsize),5) )); % % clear TEMP_TRIALS % % end % % clear TEMP_by_set TEMP_by_set_SIZE TEMP_minsize TEMP_by_set_SIZE; % % % ---------------- % ---------------- % ---------------- % ---------------- % ---------------- for ai=1:8 RT(si,ai)=nanmean(VECTOR(VECTOR(:,16)==UNIQUES(ai),5)); RTdiff(si,ai)=nanmean(VECTOR(VECTOR(:,16)==UNIQUES(ai),5))-nanmean(VECTOR(VECTOR(:,16)==UNIQUES(ai),11)); end clear VECTOR; end thecondis={'REPEAT cC','REPEAT cI','REPEAT iC','REPEAT iI','Change cC','Change cI','Change iC','Change iI'}; CONDIS=[5,6,7,8,1,2,3,4]; PANEL=[1,1,2,2,4,4,5,5]; COLOR={'bo','ro','bo','ro','bo','ro','bo','ro'}; figure; hold on plot(1,mean(RT(:,CONDIS(1))),COLOR{1}); plot(1,mean(RT(:,CONDIS(2))),COLOR{2}); legend({'CONG','INCONG'},'Location','NorthWest') for condi=1:8 plot(PANEL(condi),mean(RT(:,CONDIS(condi))),COLOR{condi}); errorbar(PANEL(condi),mean(RT(:,CONDIS(condi))),std(RT(:,CONDIS(condi)))/sqrt(size(RT,1)),'k.'); end plot([1 2],[mean(RT(:,CONDIS(1))) mean(RT(:,CONDIS(3)))],'k-'); plot([1 2],[mean(RT(:,CONDIS(2))) mean(RT(:,CONDIS(4)))],'k-'); plot([4 5],[mean(RT(:,CONDIS(5))) mean(RT(:,CONDIS(7)))],'k-'); plot([4 5],[mean(RT(:,CONDIS(6))) mean(RT(:,CONDIS(8)))],'k-'); ylabel('ms'); set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'}); title('RT'); figure; hold on plot(1,mean(RTdiff(:,CONDIS(1))),COLOR{1}); plot(1,mean(RTdiff(:,CONDIS(2))),COLOR{2}); legend({'CONG','INCONG'},'Location','NorthWest') for condi=1:8 plot(PANEL(condi),mean(RTdiff(:,CONDIS(condi))),COLOR{condi}); errorbar(PANEL(condi),mean(RTdiff(:,CONDIS(condi))),std(RTdiff(:,CONDIS(condi)))/sqrt(size(RTdiff,1)),'k.'); end plot([1 2],[mean(RTdiff(:,CONDIS(1))) mean(RTdiff(:,CONDIS(3)))],'k-'); plot([1 2],[mean(RTdiff(:,CONDIS(2))) mean(RTdiff(:,CONDIS(4)))],'k-'); plot([4 5],[mean(RTdiff(:,CONDIS(5))) mean(RTdiff(:,CONDIS(7)))],'k-'); plot([4 5],[mean(RTdiff(:,CONDIS(6))) mean(RTdiff(:,CONDIS(8)))],'k-'); ylabel('ms'); set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'}); title('RTdiff'); %% View Demographics figure; subplot(1,4,1:3); hold on boxplot(MEGA_SUBJINFO(:,[3,5,6])); ylabel('count'); set(gca,'xlim',[0 4],'xtick',[1:1:3],'xticklabel',{'Error %','Age','OCI'}); title('Demographics'); subplot(1,4,4); hold on pie([sum(MEGA_SUBJINFO(:,4)==1),sum(MEGA_SUBJINFO(:,4)==2)]) title('Sex: % Male'); %% CONFLICT CONGRUENT BigN=size(MEGA_ERP,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(:,19,t1:t2,[2,4,6,8]),4),1)),'r','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[1,3,5,7]),4),1)),'b','linewidth',2); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[2,4,6,8]),4),1)),squeeze(std(mean(MEGA_ERP(:,19,t1:t2,[2,4,6,8]),4),1))./sqrt(BigN),'r'); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[1,3,5,7]),4),1)),squeeze(std(mean(MEGA_ERP(:,19,t1:t2,[1,3,5,7]),4),1))./sqrt(BigN),'b'); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[2,4,6,8]),4),1)),'r','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,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(:,28,t1:t2,[2,4,6,8]),4),1)),squeeze(std(mean(MEGA_ERP(:,28,t1:t2,[2,4,6,8]),4),1))./sqrt(BigN),'r'); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,28,t1:t2,[1,3,5,7]),4),1)),squeeze(std(mean(MEGA_ERP(:,28,t1:t2,[1,3,5,7]),4),1))./sqrt(BigN),'b'); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,28,t1:t2,[2,4,6,8]),4),1)),'r','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,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(:,46,t1:t2,[2,4,6,8]),4),1)),squeeze(std(mean(MEGA_ERP(:,46,t1:t2,[2,4,6,8]),4),1))./sqrt(BigN),'r'); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,46,t1:t2,[1,3,5,7]),4),1)),squeeze(std(mean(MEGA_ERP(:,46,t1:t2,[1,3,5,7]),4),1))./sqrt(BigN),'b'); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,46,t1:t2,[2,4,6,8]),4),1)),'r','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,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_RESP(:,LRP_t1:LRP_t2,[2,4,6,8]),3),1)),squeeze(std(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[2,4,6,8]),3),1))./sqrt(BigN),'r'); shadedErrorBar(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[1,3,5,7]),3),1)),squeeze(std(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[1,3,5,7]),3),1))./sqrt(BigN),'b'); plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[2,4,6,8]),3),1)),'r','linewidth',2); plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,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(:,site,t1:t2,1:4),4),1)),'k','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1)),'g','linewidth',2); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1)),squeeze(std(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1))./sqrt(BigN),'k'); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1)),squeeze(std(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1))./sqrt(BigN),'g'); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1)),'k','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,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(:,site,t1:t2,1:4),4),1)),squeeze(std(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1))./sqrt(BigN),'k'); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1)),squeeze(std(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1))./sqrt(BigN),'g'); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1)),'k','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,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(:,site,t1:t2,1:4),4),1)),squeeze(std(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1))./sqrt(BigN),'k'); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1)),squeeze(std(mean(MEGA_ERP(:,site,t1:t2,5:8),4),1))./sqrt(BigN),'g'); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,site,t1:t2,1:4),4),1)),'k','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,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_RESP(:,LRP_t1:LRP_t2,1:4),3),1)),squeeze(std(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,1:4),3),1))./sqrt(BigN),'k'); shadedErrorBar(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,5:8),3),1)),squeeze(std(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,5:8),3),1))./sqrt(BigN),'g'); plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,1:4),3),1)),'k','linewidth',2); plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,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') %% PRIOR CONFLICT CONGRUENT for fun thecondis={'REPEAT cC','REPEAT cI','REPEAT iC','REPEAT iI','Change cC','Change cI','Change iC','Change iI'}; BigN=size(MEGA_ERP,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(:,19,t1:t2,[3,4,7,8]),4),1)),'r','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[1,2,5,6]),4),1)),'b','linewidth',2); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[3,4,7,8]),4),1)),squeeze(std(mean(MEGA_ERP(:,19,t1:t2,[3,4,7,8]),4),1))./sqrt(BigN),'r'); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[1,2,5,6]),4),1)),squeeze(std(mean(MEGA_ERP(:,19,t1:t2,[1,2,5,6]),4),1))./sqrt(BigN),'b'); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[3,4,7,8]),4),1)),'r','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,19,t1:t2,[1,2,5,6]),4),1)),'b','linewidth',2); plot(mean(mean(RT(:,[3,4,7,8]))),[10],'ro'); plot(mean(mean(RT(:,[1,2,5,6]))),[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({'PRIOR CONFLICT','PRIOR CONGRUENT'}) subplot(4,1,2); hold on shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,28,t1:t2,[3,4,7,8]),4),1)),squeeze(std(mean(MEGA_ERP(:,28,t1:t2,[3,4,7,8]),4),1))./sqrt(BigN),'r'); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,28,t1:t2,[1,2,5,6]),4),1)),squeeze(std(mean(MEGA_ERP(:,28,t1:t2,[1,2,5,6]),4),1))./sqrt(BigN),'b'); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,28,t1:t2,[3,4,7,8]),4),1)),'r','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,28,t1:t2,[1,2,5,6]),4),1)),'b','linewidth',2); plot(mean(mean(RT(:,[3,4,7,8]))),[10],'ro'); plot(mean(mean(RT(:,[1,2,5,6]))),[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(:,46,t1:t2,[3,4,7,8]),4),1)),squeeze(std(mean(MEGA_ERP(:,46,t1:t2,[3,4,7,8]),4),1))./sqrt(BigN),'r'); shadedErrorBar(tx2disp,squeeze(mean(mean(MEGA_ERP(:,46,t1:t2,[1,2,5,6]),4),1)),squeeze(std(mean(MEGA_ERP(:,46,t1:t2,[1,2,5,6]),4),1))./sqrt(BigN),'b'); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,46,t1:t2,[3,4,7,8]),4),1)),'r','linewidth',2); plot(tx2disp,squeeze(mean(mean(MEGA_ERP(:,46,t1:t2,[1,2,5,6]),4),1)),'b','linewidth',2); plot(mean(mean(RT(:,[3,4,7,8]))),[10],'ro'); plot(mean(mean(RT(:,[1,2,5,6]))),[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_RESP(:,LRP_t1:LRP_t2,[3,4,7,8]),3),1)),squeeze(std(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[3,4,7,8]),3),1))./sqrt(BigN),'r'); shadedErrorBar(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[1,2,5,6]),3),1)),squeeze(std(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[1,2,5,6]),3),1))./sqrt(BigN),'b'); plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[3,4,7,8]),3),1)),'r','linewidth',2); plot(LRP_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,[1,2,5,6]),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') %% ----- TRY THIS figure; subplot(2,1,1); hold on site=19; tx=-2000:2:1998; resp_t1=find(tx==-500); resp_t2=find(tx==1000); resp_tx2disp=-500:2:1000; plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,[2,4,6,8]),4),1)),'r','linewidth',2); plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,[1,3,5,7]),4),1)),'b','linewidth',2); shadedErrorBar(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,[2,4,6,8]),4),1)),squeeze(std(mean(MEGA_ERP_RESP_All(:,site,LRP_t1:LRP_t2,[2,4,6,8]),4),1))./sqrt(BigN),'r'); shadedErrorBar(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,[1,3,5,7]),4),1)),squeeze(std(mean(MEGA_ERP_RESP_All(:,site,LRP_t1:LRP_t2,[1,3,5,7]),4),1))./sqrt(BigN),'b'); plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,[2,4,6,8]),4),1)),'r','linewidth',2); plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,[1,3,5,7]),4),1)),'b','linewidth',2); plot([0 0],[-4 4],'k:'); plot([-500 1000],[0 0],'k:'); plot([200 200],[-2 2],'c'); plot([500 500],[-2 2],'c'); title('Resp') legend({'CONGRUENT','CONFLICT'}) subplot(2,1,2); hold on plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,1:4),4),1)),'k','linewidth',2); plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,5:8),4),1)),'g','linewidth',2); shadedErrorBar(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,1:4),4),1)),squeeze(std(mean(MEGA_ERP_RESP_All(:,site,LRP_t1:LRP_t2,1:4),4),1))./sqrt(BigN),'k'); shadedErrorBar(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,5:8),4),1)),squeeze(std(mean(MEGA_ERP_RESP_All(:,site,LRP_t1:LRP_t2,5:8),4),1))./sqrt(BigN),'g'); plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,1:4),4),1)),'k','linewidth',2); plot(resp_tx2disp,squeeze(mean(mean(MEGA_ERP_RESP_All(:,site,resp_t1:resp_t2,5:8),4),1)),'g','linewidth',2); plot([0 0],[-4 4],'k:'); plot([-500 1000],[0 0],'k:'); plot([200 200],[-2 2],'c'); plot([500 500],[-2 2],'c'); title('Resp') legend({'REPEAT','SWITCH'}) ERPmean=squeeze(mean(MEGA_ERP_RESP_All(:,site,find(tx==200):find(tx==500),:),3)); LRP_TITLE='FCz Resp'; CONDIS=[5,6,7,8,1,2,3,4]; PANEL=[1,1,2,2,4,4,5,5]; COLOR={'bo','ro','bo','ro','bo','ro','bo','ro'}; figure; hold on plot(1,mean(ERPmean(:,CONDIS(1))),COLOR{1}); plot(1,mean(ERPmean(:,CONDIS(2))),COLOR{2}); legend({'CONG','INCONG'},'Location','NorthWest') for condi=1:8 plot(PANEL(condi),mean(ERPmean(:,CONDIS(condi))),COLOR{condi}); errorbar(PANEL(condi),mean(ERPmean(:,CONDIS(condi))),std(ERPmean(:,CONDIS(condi)))/sqrt(size(ERPmean,1)),'k.'); end plot([1 2],[mean(ERPmean(:,CONDIS(1))) mean(ERPmean(:,CONDIS(3)))],'k-'); plot([1 2],[mean(ERPmean(:,CONDIS(2))) mean(ERPmean(:,CONDIS(4)))],'k-'); plot([4 5],[mean(ERPmean(:,CONDIS(5))) mean(ERPmean(:,CONDIS(7)))],'k-'); plot([4 5],[mean(ERPmean(:,CONDIS(6))) mean(ERPmean(:,CONDIS(8)))],'k-'); ylabel('uV'); set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'}); title(LRP_TITLE); FCzRESP_4SPSS=squeeze(mean(MEGA_ERP_RESP_All(:,site,find(tx==200):find(tx==500),:),3)); figure; subplot(1,2,1) resp_t1=find(tx==200); resp_t2=find(tx==500); A=mean(mean(MEGA_ERP_RESP_All(:,:,resp_t1:resp_t2,[2,4,6,8]),4),3); B=mean(mean(MEGA_ERP_RESP_All(:,:,resp_t1:resp_t2,[1,3,5,7]),4),3); [H,P,CI,STATS]=ttest(A,B); P(P>=.05)=NaN; P(P<.05)=1; P(isnan(P))=0; THESEDATA=squeeze(mean(A,1)-mean(B,1)); topoplot(THESEDATA,chanlocs,'emarker2', {find(P),'d','k',5,1}); title('CONF-CONGRU') subplot(1,2,2) resp_t1=find(tx==200); resp_t2=find(tx==500); A=mean(mean(MEGA_ERP_RESP_All(:,:,resp_t1:resp_t2,1:4),4),3); B=mean(mean(MEGA_ERP_RESP_All(:,:,resp_t1:resp_t2,5:8),4),3); [H,P,CI,STATS]=ttest(A,B); P(P>=.05)=NaN; P(P<.05)=1; P(isnan(P))=0; THESEDATA=squeeze(mean(B,1)-mean(A,1)); topoplot(THESEDATA,chanlocs,'emarker2', {find(P),'d','k',5,1}); title('SWITCH-REPEAT') %% TOPOS % Divide range by 2 to get samples TIMEWINS{1}=find(tx==P2)-5:find(tx==P2)+5 ; TIMEWINS{2}=find(tx==N2+1)-10:find(tx==N2+1)+10 ; TIMEWINS{3}=find(tx==P3)-(P3range/2):find(tx==P3)+(P3range/2) ; TIMEWINS{4}=find(tx==LATE)-(LATErange/2):find(tx==LATE)+(LATErange/2) ; TITLES={'P2','N2','P3','Late'}; figure; for fi=2:4 subplot(1,3,fi-1); hold on; A=mean(mean(MEGA_ERP(:,:,TIMEWINS{fi},[2,4,6,8]),4),3); B=mean(mean(MEGA_ERP(:,:,TIMEWINS{fi},[1,3,5,7]),4),3); [H,P,CI,STATS]=ttest(A,B); P(P>=.05)=NaN; P(P<.05)=1; P(isnan(P))=0; THESEDATA=squeeze(mean(A,1)-mean(B,1)); topoplot(THESEDATA,chanlocs,'emarker2', {find(P),'d','k',5,1}); title(TITLES{fi}) clear THESEDATA A B; end figure; for fi=2:4 subplot(1,3,fi-1); hold on; A=mean(mean(MEGA_ERP(:,:,TIMEWINS{fi},5:8),4),3); B=mean(mean(MEGA_ERP(:,:,TIMEWINS{fi},1:4),4),3); [H,P,CI,STATS]=ttest(A,B); P(P>=.05)=NaN; P(P<.05)=1; P(isnan(P))=0; THESEDATA=squeeze(mean(A,1)-mean(B,1)); topoplot(THESEDATA,chanlocs,'emarker2', {find(P),'d','k',5,1}); title(TITLES{fi}) clear THESEDATA A B; end %% 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(:,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,1) for ai=1:3 % SITE=[FCz,Cz,Pz] for ci=1:8 idx=find(squeeze(MEGA_ERP(si,SITE(ai),TIMEWINS_LAT,ci))==max(squeeze(MEGA_ERP(si,SITE(ai),TIMEWINS_LAT,ci)))); P3Latency(si,ai,ci)=P3actuallatency(idx); end end end figure; boxplot(squeeze(P3Latency(:,3,:))); title('P3 latencies at Pz'); P3Peak_Conf=mean(mean(P3Latency(:,3,[2,4,6,8]),3)); P3Peak_Cong=mean(mean(P3Latency(:,3,[1,3,5,7]),3)); P3Peak_Rep=mean(mean(P3Latency(:,3,1:4),3)); P3Peak_Swtch=mean(mean(P3Latency(:,3,5:8),3)); %% 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)); % % AMP=zscore(squeeze(mean(MEANS(:,CHAN,TIME,:),2)),[],2); % % LAT=zscore(squeeze(mean(P3Latency(:,3,:),2)),[],2); % % ERPmean=(AMP+LAT)/2; TITLE=' '; % N2 is FCz % P3 is Cz, Pz % P3 latency is Pz CONDIS=[5,6,7,8,1,2,3,4]; PANEL=[1,1,2,2,4,4,5,5]; COLOR={'bo','ro','bo','ro','bo','ro','bo','ro'}; figure; hold on plot(1,mean(ERPmean(:,CONDIS(1))),COLOR{1}); plot(1,mean(ERPmean(:,CONDIS(2))),COLOR{2}); legend({'CONG','INCONG'},'Location','NorthWest') for condi=1:8 plot(PANEL(condi),mean(ERPmean(:,CONDIS(condi))),COLOR{condi}); errorbar(PANEL(condi),mean(ERPmean(:,CONDIS(condi))),std(ERPmean(:,CONDIS(condi)))/sqrt(size(ERPmean,1)),'k.'); end plot([1 2],[mean(ERPmean(:,CONDIS(1))) mean(ERPmean(:,CONDIS(3)))],'k-'); plot([1 2],[mean(ERPmean(:,CONDIS(2))) mean(ERPmean(:,CONDIS(4)))],'k-'); plot([4 5],[mean(ERPmean(:,CONDIS(5))) mean(ERPmean(:,CONDIS(7)))],'k-'); plot([4 5],[mean(ERPmean(:,CONDIS(6))) mean(ERPmean(:,CONDIS(8)))],'k-'); set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'}); title(TITLE); %% lrp1=find(tx==-300); lrp2=find(tx==-150); lrp3=find(tx==-50); ERPmean=-1* (squeeze(mean(MEGA_ERP_RESP(:,lrp3,:),2))-squeeze(mean(MEGA_ERP_RESP(:,lrp2,:),2)) ); LRP_TITLE='LRP SLOPE'; % ERPmean=squeeze(mean(MEGA_ERP_RESP(:,lrp1:lrp2,:),2)); LRP_TITLE='PRE-LRP'; CONDIS=[5,6,7,8,1,2,3,4]; PANEL=[1,1,2,2,4,4,5,5]; COLOR={'bo','ro','bo','ro','bo','ro','bo','ro'}; figure; hold on plot(1,mean(ERPmean(:,CONDIS(1))),COLOR{1}); plot(1,mean(ERPmean(:,CONDIS(2))),COLOR{2}); legend({'CONG','INCONG'},'Location','NorthWest') for condi=1:8 plot(PANEL(condi),mean(ERPmean(:,CONDIS(condi))),COLOR{condi}); errorbar(PANEL(condi),mean(ERPmean(:,CONDIS(condi))),std(ERPmean(:,CONDIS(condi)))/sqrt(size(ERPmean,1)),'k.'); end plot([1 2],[mean(ERPmean(:,CONDIS(1))) mean(ERPmean(:,CONDIS(3)))],'k-'); plot([1 2],[mean(ERPmean(:,CONDIS(2))) mean(ERPmean(:,CONDIS(4)))],'k-'); plot([4 5],[mean(ERPmean(:,CONDIS(5))) mean(ERPmean(:,CONDIS(7)))],'k-'); plot([4 5],[mean(ERPmean(:,CONDIS(6))) mean(ERPmean(:,CONDIS(8)))],'k-'); ylabel('uV'); set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'}); title(LRP_TITLE); LRP_4SPSS=squeeze(mean(MEGA_ERP_RESP(:,LRP_t1:LRP_t2,:),2)); %% TF frex=logspace(.01,1.7,50); figure; hold on; imagesc(tx2disp,[],squeeze(mean(mean(MEGA_PWR{1},1),4))); % [H,P,CI,STATS]=ttest(squeeze( CTL.POWER{Bidx}(:,CHANI,:,:,conflict,EVENT)) , squeeze( ON.POWER{Bidx}(:,CHANI,:,:,conflict,EVENT))); % P(P<=.05)=NaN; P(P>.05)=0; P(isnan(P))=1; P=squeeze(P); % contour(tx2disp,1:50,P,'k','linewidth',2); clear Corrected_P H P CI STATS; plot([300 300],[17 24],'k'); plot([500 500],[17 24],'k'); plot([300 500],[17 17],'k') ;plot([300 500],[24 24],'k'); plot([0 0],[1 50],'k:') set(gca,'clim',[-4 4],'xlim',[-500,1000],'ylim',[1 50],'YTick',1:4:length(frex),'YTickLabel',round(frex(1:4:end))); CUETHETA_4SPSS=squeeze(mean(mean(MEGA_PWR{1}(:,17:24,find(tx2disp==300):find(tx2disp==500),:),2),3)); figure; hold on plot(1,mean(CUETHETA_4SPSS(:,CONDIS(1))),COLOR{1}); plot(1,mean(CUETHETA_4SPSS(:,CONDIS(2))),COLOR{2}); legend({'CONG','INCONG'},'Location','NorthWest') for condi=1:8 plot(PANEL(condi),mean(CUETHETA_4SPSS(:,CONDIS(condi))),COLOR{condi}); errorbar(PANEL(condi),mean(CUETHETA_4SPSS(:,CONDIS(condi))),std(CUETHETA_4SPSS(:,CONDIS(condi)))/sqrt(size(CUETHETA_4SPSS,1)),'k.'); end plot([1 2],[mean(CUETHETA_4SPSS(:,CONDIS(1))) mean(CUETHETA_4SPSS(:,CONDIS(3)))],'k-'); plot([1 2],[mean(CUETHETA_4SPSS(:,CONDIS(2))) mean(CUETHETA_4SPSS(:,CONDIS(4)))],'k-'); plot([4 5],[mean(CUETHETA_4SPSS(:,CONDIS(5))) mean(CUETHETA_4SPSS(:,CONDIS(7)))],'k-'); plot([4 5],[mean(CUETHETA_4SPSS(:,CONDIS(6))) mean(CUETHETA_4SPSS(:,CONDIS(8)))],'k-'); ylabel('uV'); set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'}); title('Cue Theta'); figure; hold on; imagesc(tx2disp,[],squeeze(mean(mean(MEGA_PWR{2},1),4))); % [H,P,CI,STATS]=ttest(squeeze( CTL.POWER{Bidx}(:,CHANI,:,:,conflict,EVENT)) , squeeze( ON.POWER{Bidx}(:,CHANI,:,:,conflict,EVENT))); % P(P<=.05)=NaN; P(P>.05)=0; P(isnan(P))=1; P=squeeze(P); % contour(tx2disp,1:50,P,'k','linewidth',2); clear Corrected_P H P CI STATS; plot([-200 -200],[17 24],'k'); plot([50 50],[17 24],'k'); plot([-200 50],[17 17],'k') ;plot([-200 50],[24 24],'k'); plot([0 0],[1 50],'k:') set(gca,'clim',[-2 2],'xlim',[-500,1000],'ylim',[1 50],'YTick',1:4:length(frex),'YTickLabel',round(frex(1:4:end))); RESPTHETA_4SPSS=squeeze(mean(mean(MEGA_PWR{2}(:,17:24,find(tx2disp==-200):find(tx2disp==50),:),2),3)); figure; hold on plot(1,mean(RESPTHETA_4SPSS(:,CONDIS(1))),COLOR{1}); plot(1,mean(RESPTHETA_4SPSS(:,CONDIS(2))),COLOR{2}); legend({'CONG','INCONG'},'Location','NorthWest') for condi=1:8 plot(PANEL(condi),mean(RESPTHETA_4SPSS(:,CONDIS(condi))),COLOR{condi}); errorbar(PANEL(condi),mean(RESPTHETA_4SPSS(:,CONDIS(condi))),std(RESPTHETA_4SPSS(:,CONDIS(condi)))/sqrt(size(RESPTHETA_4SPSS,1)),'k.'); end plot([1 2],[mean(RESPTHETA_4SPSS(:,CONDIS(1))) mean(RESPTHETA_4SPSS(:,CONDIS(3)))],'k-'); plot([1 2],[mean(RESPTHETA_4SPSS(:,CONDIS(2))) mean(RESPTHETA_4SPSS(:,CONDIS(4)))],'k-'); plot([4 5],[mean(RESPTHETA_4SPSS(:,CONDIS(5))) mean(RESPTHETA_4SPSS(:,CONDIS(7)))],'k-'); plot([4 5],[mean(RESPTHETA_4SPSS(:,CONDIS(6))) mean(RESPTHETA_4SPSS(:,CONDIS(8)))],'k-'); ylabel('uV'); set(gca,'xlim',[0 6],'xtick',[1:1:5],'xticklabel',{'PREV C','PREV I','','PREV C','PREV I'}); title('Resp Theta'); figure; hold on; imagesc(tx2disp,[],squeeze(mean(mean(MEGA_PHS{1},1),4))); plot([100 100],[17 24],'k'); plot([300 300],[17 24],'k'); plot([100 300],[17 17],'k') ;plot([100 300],[24 24],'k'); plot([0 0],[1 50],'k:') set(gca,'clim',[0 .5],'xlim',[-500,1000],'ylim',[1 50],'YTick',1:4:length(frex),'YTickLabel',round(frex(1:4:end))); CUEPHS_4SPSS=squeeze(mean(mean(MEGA_PHS{1}(:,17:24,find(tx2disp==100):find(tx2disp==300),:),2),3)); figure; hold on; imagesc(-1000:2:500,[],squeeze(mean(mean(MEGA_PHS{2},1),4))); plot([100 100],[2 10],'k'); plot([300 300],[2 10],'k'); plot([100 300],[2 2],'k') ;plot([100 300],[10 10],'k'); plot([0 0],[1 50],'k:') set(gca,'clim',[0 .5],'xlim',[-1000,500],'ylim',[1 50],'YTick',1:4:length(frex),'YTickLabel',round(frex(1:4:end))); %%