Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorial:cluster_permutation_timelock [2017/08/17 12:33]
127.0.0.1 external edit
tutorial:cluster_permutation_timelock [2018/04/09 20:21] (current)
Line 219: Line 219:
   m = [1:​timestep*sampling_rate:​sample_count]; ​ % temporal endpoints in MEEG samples   m = [1:​timestep*sampling_rate:​sample_count]; ​ % temporal endpoints in MEEG samples
  
-  ​ 
 To plot the data use the following for-loop: ​ To plot the data use the following for-loop: ​
  
 +  % First ensure the channels to have the same order in the average and in the statistical output.
 +  % This might not be the case, because ft_math might shuffle the order  ​
 +  [i1,i2] = match_str(raweffectFICvsFC.label,​ stat.label); ​
 +  ​
   for k = 1:20;   for k = 1:20;
        ​subplot(4,​5,​k);​        ​subplot(4,​5,​k);​
Line 233: Line 236:
     % Next, check which channels are significant over the     % Next, check which channels are significant over the
     % entire time interval of interest.     % entire time interval of interest.
-       ​pos_int = all(pos(:, m(k):​m(k+1)),​ 2); +       ​pos_int ​= zeros(numel(raweffectFICvsFC.label),​1);​ 
-       ​neg_int = all(neg(:, m(k):​m(k+1)),​ 2);+       ​neg_int = zeros(numel(raweffectFICvsFC.label),​1);​ 
 +       ​pos_int(i1) ​= all(pos(i2, m(k):​m(k+1)),​ 2); 
 +       ​neg_int(i1) = all(neg(i2, m(k):​m(k+1)),​ 2);
   ​   ​
        ​cfg.highlight = '​on';​        ​cfg.highlight = '​on';​
Line 241: Line 246:
        ​cfg.comment = '​xlim'; ​          ​cfg.comment = '​xlim'; ​  
        ​cfg.commentpos = '​title'; ​          ​cfg.commentpos = '​title'; ​  
-       ​cfg.layout = 'CTF151.lay';+       ​cfg.layout = 'CTF151_helmet.mat';
        ​cfg.interactive = '​no';​        ​cfg.interactive = '​no';​
        ​ft_topoplotER(cfg,​ raweffectFICvsFC); ​          ​ft_topoplotER(cfg,​ raweffectFICvsFC); ​  
Line 334: Line 339:
   ​   ​
   % Remember to do the same for negative clusters if you want them!   % Remember to do the same for negative clusters if you want them!
 +  ​
 +  % First ensure the channels to have the same order in the average and in the statistical output.
 +  % This might not be the case, because ft_math might shuffle the order  ​
 +  [i1,i2] = match_str(raweffectFICvsFC.label,​ stat.label); ​
   ​   ​
   for k = 1:20;   for k = 1:20;
Line 340: Line 349:
        ​cfg.xlim =[j(k) j(k+1)];        ​cfg.xlim =[j(k) j(k+1)];
        ​cfg.zlim = [-1.0e-13 1.0e-13]; ​          ​cfg.zlim = [-1.0e-13 1.0e-13]; ​  
-       ​pos_int = all(pos(:, m(k):​m(k+1)),​ 2);+       ​pos_int ​= zeros(numel(raweffectFICvsFC.label),​1);​ 
 +       ​pos_int(i1) ​= all(pos(i2, m(k):​m(k+1)),​ 2);
        ​cfg.highlight = '​on';​        ​cfg.highlight = '​on';​
        ​cfg.highlightchannel = find(pos_int);​        ​cfg.highlightchannel = find(pos_int);​
        ​cfg.comment = '​xlim';​        ​cfg.comment = '​xlim';​
        ​cfg.commentpos = '​title';​        ​cfg.commentpos = '​title';​
-       ​cfg.layout = 'CTF151.lay';+       ​cfg.layout = 'CTF151_helmet.mat';
        ​ft_topoplotER(cfg,​ raweffectFICvsFC);​        ​ft_topoplotER(cfg,​ raweffectFICvsFC);​
   end   end
Line 461: Line 471:
   pos_signif_clust = find(pos_cluster_pvals < stat.cfg.alpha);​   pos_signif_clust = find(pos_cluster_pvals < stat.cfg.alpha);​
   pos = ismember(stat.posclusterslabelmat,​ pos_signif_clust);​   pos = ismember(stat.posclusterslabelmat,​ pos_signif_clust);​
 +    ​
 +  % First ensure the channels to have the same order in the average and in the statistical output.
 +  % This might not be the case, because ft_math might shuffle the order  ​
 +  [i1,i2] = match_str(GA_FICvsFC.label,​ stat.label); ​
   ​   ​
   % plot   % plot
Line 468: Line 482:
        ​cfg.xlim=[j(k) j(k+1)]; ​          ​cfg.xlim=[j(k) j(k+1)]; ​  
        ​cfg.zlim = [-5e-14 5e-14]; ​          ​cfg.zlim = [-5e-14 5e-14]; ​  
-       ​pos_int = all(pos(:, m(k):​m(k+1)),​ 2);+       ​pos_int ​= zeros(numel(GA_FICvsFC.label),​1);​ 
 +       ​pos_int(i1) ​= all(pos(i2, m(k):​m(k+1)),​ 2);
        ​cfg.highlight = '​on';​        ​cfg.highlight = '​on';​
        ​cfg.highlightchannel = find(pos_int); ​              ​cfg.highlightchannel = find(pos_int); ​      
        ​cfg.comment = '​xlim'; ​          ​cfg.comment = '​xlim'; ​  
        ​cfg.commentpos = '​title'; ​          ​cfg.commentpos = '​title'; ​  
-       ​cfg.layout = 'CTF151.lay';+       ​cfg.layout = 'CTF151_helmet.mat';
        ​ft_topoplotER(cfg,​ GA_FICvsFC);​        ​ft_topoplotER(cfg,​ GA_FICvsFC);​
   end  ​   end  ​