<div dir="ltr">Dear all,<div><br></div><div>I'm just starting to work on a cluster-based permutation test script based on the tutorial for within-subject designs on the fieldtrip website. I ran into an issue when computing the [stat] matrix. I used the code as it was on the website:</div><div><br></div><div>[stat] = ft_timelockstatistics(cfg, Correct{:}, Incorrect{:});<br></div><div><br></div><div>with the Correct and Incorrect matrices looking as follows:</div><div><br></div><div><div>Correct{1}</div><div><br></div><div>        avg: [34x600 double]</div><div>       time: [1x600 double]</div><div>    fsample: '500'</div><div>      label: {34x1 cell}</div><div>     dimord: 'chan_time'</div><div>        dof: [34x600 double]</div><div>        var: [34x600 double]</div></div><div><br></div><div>The function runs without problems, i.e I don't get any error messages. However, the result seems incomplete. </div><div><br></div><div><div>stat = </div><div>                   prob: [25x1 double]</div><div>            posclusters: []</div><div>    posclusterslabelmat: [25x1 double]</div><div>        posdistribution: [1x500 double]</div><div>            negclusters: [1x1 struct]</div><div>    negclusterslabelmat: [25x1 double]</div><div>        negdistribution: [1x500 double]</div><div>                cirange: [25x1 double]</div><div>                   mask: [25x1 logical]</div><div>                   stat: [25x1 double]</div><div>                    ref: [25x1 double]</div><div>                 dimord: 'chan_time'</div><div>                  label: {25x1 cell}</div><div>                   time: 0</div><div>                    cfg: [1x1 struct]</div></div><div><br></div><div>Specifically, I later run into trouble with the stat.posclusterslabelmat and stat.negclusterslabelmat matrices which should apparantly contain far more values something more like 25x500 instead of 25x1. When calling </div><div>neg_int = all(neg(:, m(k):m(k+1)), 2) </div><div>I get the "Index exceeds matrix dimensions" error message which I assume has to do with the fact that "neg" does not have the appropriate matrix dimensions </div><div>(neg = ismember(stat.negclusterslabelmat, neg_signif_clust); )</div><div><br></div><div>Where is the error / where should I look for the error? </div><div><br></div><div>Some further design details:</div><div>Nsubj = 24</div><div>2 conditions = Correct, Incorrect</div><div>Within-subject design</div><div>sampling rate = 500</div><div>34 channels </div><div><br></div><div>I hope I gave enough / the necessary information for someone to help me out. </div><div><br></div><div>Thanks in advance! </div><div><br></div><div>Best,</div><div>Anne</div><div><br></div></div>