123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- clear all
- mainfolder='';
- addpath(genpath([mainfolder, 'subfunctions/']))
- addpath(genpath(['subfunctions/rm_anova2']))
- %% Uncomment to load the RSA data and perform the cluster perm
- % folder{1}=[mainfolder,'results/mean_recentered_th100/euclideanmodels/single_trial_RSA_first_check_object_1_cued_Pearson/']
- % folder{2}=[mainfolder,'results/mean_recentered_th100/euclideanmodels/single_trial_RSA_first_check_object_1_uncued_Pearson/']
- % folder{3}=[mainfolder,'results/mean_recentered_th100/euclideanmodels/single_trial_RSA_first_check_object_2_cued_Pearson/']
- % folder{4}=[mainfolder,'results/mean_recentered_th100/euclideanmodels/single_trial_RSA_first_check_object_2_uncued_Pearson/']
- %
- % load([mainfolder, 'good_partis.mat']) %list of participant with a good performance
- % partis=good_partis';
- %
- %
- % for fff=1:size(folder,2)
- %
- % counter=1;
- % RHO_id=[];
- %
- % for ppp=1:length(partis)
- %
- % toload=[folder{fff}, partis{ppp,:},'.mat']
- % load(toload)
- % RHO_id(:,counter)=nanmean(RSA_obj_rot.rho,1);
- % counter=counter+1;
- %
- % end
- % RHO_all{fff}=RHO_id
- % end
- %
- % time=RSA_obj_rot.time;
- %
- %
- % %% Cluster analysis for each line
- %
- % pv_cluster=0.0125; % p-vals for clust perm test
- % az=zeros(size(RHO_all{1})); % matrix to be compare (in this case against 0);
- %
- % timesignclust=allclustperm(RHO_all,time,az,pv_cluster) % output variable (rows -> lines; columns -> start and end (ms))
- %
- % mean([timesignclust(1,1) timesignclust(2,1) timesignclust(3,1)-1000 timesignclust(4,1)-1000]) %average of "starting" point;
- %
- %
- % %% Detecting peaks during encoding
- %
- % maxstim1cue=maxintime(RHO_all{1},time,0,1000)
- % maxstim1uncue=maxintime(RHO_all{2},time,0,1000)
- % maxstim2cue=maxintime(RHO_all{3},time,1000,2000)-1000
- % maxstim2uncue=maxintime(RHO_all{4},time,1000,2000)-1000
- %
- % mean([maxstim1cue maxstim1uncue maxstim2cue maxstim2uncue]) %returning average from all 4 lines
- %% Optional -> Loading the data ready to be plotted
- load('data_for_plots/Figure_2/delay1_data_n41_2022.mat');
- %% And plot
- colores1=(colormap(flip(autumn(7))));
- colores2=(colormap(flip(summer(7))));
- colores=[colores2(7,:);colores1(7,:);colores2(5,:);colores1(4,:)];
- figure('Position',([200 900 760 360])) %alt ([200 900 860 360]))
- leng1='cued 1st'
- leng2='uncued'
- leng3='cued 1st'
- leng4='uncued'
- titu=[];%'RSA - Correlation with continuos model - single trial'
- xl=[-500 5850];
- yl=[-0.05 0.17];
- aga=0;
- pval=0.01
- spa=-0.004
- data=[];
- data{1}=RHO_all{1};
- data{2}=RHO_all{2};
- data{3}=RHO_all{3};
- data{4}=RHO_all{4};
- % plot4lines_fdr(time,data,colores,xl,yl,leng1,leng2,leng3,leng4,titu,aga,pval,spa,1)
- plot4lines(time,data,colores,xl,yl,leng1,leng2,leng3,leng4,titu,1,1,1,timesignclust,colores)
- % fill([2000 2350 2000 2350],[20 20 0 0],'k','LineStyle','none','FaceAlpha',0.20);
- set(gca,'FontSize',22);
-
- %% 2nd delay
- clear all
- %% Uncomment to load the RSA data and perform the cluster perm
- %
- % folder{1}=[mainfolder,'results/mean_recentered_th100/euclideanmodels/2nd_cue/single_trial_RSA_first_check_object_1_cued_Pearson/']
- % folder{2}=[mainfolder,'results/mean_recentered_th100/euclideanmodels/2nd_cue/single_trial_RSA_first_check_object_1_uncued_Pearson/']
- % folder{3}=[mainfolder,'results/mean_recentered_th100/euclideanmodels/2nd_cue/single_trial_RSA_first_check_object_2_cued_Pearson/']
- % folder{4}=[mainfolder,'results/mean_recentered_th100/euclideanmodels/2nd_cue/single_trial_RSA_first_check_object_2_uncued_Pearson/']
- %
- % load([mainfolder, 'good_partis.mat']) %list of participant with a good performance
- % partis=good_partis';
- %
- % for fff=1:size(folder,2)
- %
- % counter=1;
- % RHO_id=[];
- %
- % for ppp=1:length(partis)
- %
- % toload=[folder{fff}, partis{ppp,:},'.mat']
- % load(toload)
- % RHO_id(:,counter)=nanmean(RSA_obj_rot.rho,1);
- % counter=counter+1;
- %
- % end
- % RHO_all{fff}=RHO_id
- % end
- %
- % time=RSA_obj_rot.time;
- %
- % %% Cluster analysis for each line
- %
- % pv_cluster=0.0125; % p-vals for clust perm test
- % az=zeros(size(RHO_all{1})); % matrix to be compare (in this case against 0);
- %
- % timesignclust=allclustperm(RHO_all,time,az,pv_cluster) % output variable (rows -> lines; columns -> start and end (ms))
- %
- % % mean([timesignclust(1,1) timesignclust(2,1) timesignclust(3,1)-1000 timesignclust(4,1)-1000]) %average of "starting" point;
- %% And plot
- %% Optional -> Loading the data ready to be plotted
- load('data_for_plots/Figure_2/delay2_data_n41_2022.mat');
- %% mode 6
- colores1=(colormap(flip(autumn(7))));
- colores2=(colormap(flip(summer(7))));
- colores=[colores2(7,:);colores1(7,:);colores2(5,:);colores1(4,:)];
- figure('Position',([200 900 420 360])) % alt. [200 900 440 360]
- leng1='cued 1st'
- leng2='cued 2nd'
- leng3='cued 1st'
- leng4='cued 2nd'
- titu=[];%'RSA - Correlation with continuos model - single trial'
- xl=[-300 2850];
- yl=[-0.05 0.17];
- aga=0;
- pval=0.01
- spa=-0.004
- data=[];
- data{1}=RHO_all{1};
- data{2}=RHO_all{2};
- data{3}=RHO_all{3};
- data{4}=RHO_all{4};
- % plot4lines_fdr_2nd_2(time,data,colores,xl,yl,leng1,leng2,leng3,leng4,titu,aga,pval,spa,1)
- plot4lines_2nd(time,data,colores,xl,yl,leng1,leng2,leng3,leng4,titu,1,1,1,timesignclust,colores)
- set(gca,'FontSize',22);
-
- %% Subfunctions
- %Times for encoding of stimulus 1
- function output = maxintime(data,time,toi1,toi2)
- t1=find(time==toi1);
- t2=find(time==toi2);
- time2=time(t1:t2);
- [B I]=sort(mean(data(t1:t2,:),2),'descend');
- output=time2(I(1));
- end
- function timesignclust=allclustperm(RHO_all,time,az,pv_cluster)
- timesignclust=nan(4,2); % output variable (rows -> lines; columns -> start and end (ms))
- for r=1:4;
- [clusters, p_values, t_sums, permutation_distribution] =permutest(RHO_all{r},az,1,0.05,5000)
- if p_values(1)<pv_cluster
-
- timesignclust(r,1)=time(clusters{1}(1))
- timesignclust(r,2)=time(clusters{1}(end))
-
- end
- end
- end
|