<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
Hi Anne,
<div><br>
</div>
<div>I don’t know what’s going on. </div>
<div><br>
</div>
<div>Have you tried cfg.neighbours = {} (i.e. curly rather than square brackets), and/or explicitly defined cfg.connectivity = []; ?</div>
<div><br>
</div>
<div>Best wishes,</div>
<div>Jan-Mathijs</div>
<div><br id="lineBreakAtBeginningOfMessage">
<div><br>
<blockquote type="cite">
<div>On 19 Dec 2024, at 12:18, Anne Guérin via fieldtrip <fieldtrip@science.ru.nl> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2">Hi,<span class="Apple-converted-space"> </span><br>
</font></p>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2">I would like to use the FT permutations test with cluster based correction on 2D data freq x time with a within subject design. Data are obtained after sources reconstruction and are for example related to a particular ROI (e.g. V5_R). The first
 dimension is a frequency dimension but not the oscillatory brain frequency. This dimension is linked to a temporal frequency of the input visual stimulus. the second dimension is time (sRate = 1kHz) and data are timelocked ERP for different values of this
 temporale frequency (by step of 1Hz). The data therefore has the same structure as if it had been obtained by time-frequency analysis on a particular electrode.<span class="Apple-converted-space"> </span><br>
</font></p>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2">For example, here's the data for one participant:<br>
ftAllFiles{1}<br>
<br>
ans =<span class="Apple-converted-space"> </span><br>
<br>
  struct with fields:<br>
<br>
    dimord: 'freq_time'<br>
       avg: [29×401 double]<br>
      time: [-0.2000 -0.1990 -0.1980 -0.1970 -0.1960 -0.1950 -0.1940 -0.1930 -0.1920 -0.1910 -0.1900 -0.1890 -0.1880 -0.1870 -0.1860 … ]<br>
      freq: [6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34]<br>
     label: {'V5_R'}<br>
There are 29 participants for each conditions. ftAllFiles have 2x29 cells, the first 29 correspond to the first condition and the last 29 to the second condition.<span class="Apple-converted-space"> </span><br>
</font></p>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2">Here is the configuration :<span class="Apple-converted-space"> </span><br>
</font></p>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2">>> statcfg<br>
<br>
statcfg =<span class="Apple-converted-space"> </span><br>
<br>
  struct with fields:<br>
<br>
           frequency: 'all'<br>
           parameter: 'avg'<br>
         avgoverfreq: 'no'<br>
         avgoverchan: 'no'<br>
             latency: 'all'<br>
              method: 'montecarlo'<br>
           statistic: 'ft_statfun_depsamplesT'<br>
            correctm: 'cluster'<br>
        clusteralpha: 0.0500<br>
    clusterstatistic: 'maxsum'<br>
           minnbchan: 0<br>
                tail: 1<br>
         clustertail: 1<br>
               alpha: 0.0500<br>
    numrandomization: 100000<br>
                ivar: 1<br>
                uvar: 2<br>
              design: [2×58 double]<br>
             channel: 'all'<br>
          neighbours: []<br>
         avgovertime: 'no'</font></p>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2">When I run   ftStat = ft_freqstatistics(statcfg, ftAllFiles{:}); , the program stops at the step 'findcluster':</font></p>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2">posclusobs = findcluster(tmp, connmat, cfg.minnbchan);</font></p>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2">In fact tmp is 2D boolean table (29 frequency samples x 401 time samples), connmat is 4x4 matrix with 0 and <span class="Apple-converted-space"> </span></font><font size="2">cfg.minnbchan=0.  So bug with<span class="Apple-converted-space"> </span></font><font size="2">findcluster.
 See below.<span class="Apple-converted-space"> </span><br>
</font></p>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2">When I plot tmp (image(tmp)), the result doesn't look ridiculous.<span class="Apple-converted-space"> </span><br>
 <br>
</font></p>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2">How to have a good configuration of neighborhood for this single-sensor time-frequency permutation test ? </font></p>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2">Thank you for your help. </font></p>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2">Best regards. </font></p>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2">Anne</font></p>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2">ps : <span class="Apple-converted-space"> </span><br>
</font></p>
<div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<br class="webkit-block-placeholder">
</div>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2">>>     ftStat = ft_freqstatistics(statcfg, ftAllFiles{:});<br>
the call to "ft_selectdata" took 0 seconds<br>
using "ft_statistics_montecarlo" for the statistical testing<br>
using "ft_statfun_depsamplesT" for the single-sample statistics<br>
constructing randomized design<br>
total number of measurements     = 58<br>
total number of variables        = 2<br>
number of independent variables  = 1<br>
number of unit variables         = 1<br>
number of within-cell variables  = 0<br>
number of control variables      = 0<br>
using a permutation resampling approach<br>
repeated measurement in variable 2 over 29 levels<br>
number of repeated measurements in each level is 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2<span class="Apple-converted-space"> </span><br>
the maximum number of unique permutations is 536870912<br>
generated 100000 random permutations<br>
computing a parametric threshold for clustering<br>
computing statistic<br>
estimated time per randomization is 0.00 seconds<br>
computing statistic 100000 from 100000<br>
<br>
Error using findcluster<br>
invalid dimension of spatdimneighbstructmat<br>
<br>
Error in clusterstat (line 214)<br>
  posclusobs = findcluster(tmp, connmat, cfg.minnbchan);<br>
<br>
Error in ft_statistics_montecarlo (line 364)<br>
  [stat, cfg] = clusterstat(cfg, statrand, statobs);<br>
<br>
Error in ft_freqstatistics (line 194)<br>
  [stat, cfg] = statmethod(cfg, dat, design);<br>
</font></p>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2"> <br>
</font></p>
<p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font size="2"><br>
</font></p>
<pre class="moz-signature" cols="72" style="caret-color: rgb(0, 0, 0); font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">-- 
Anne Guérin-Dugué
PR Emérite Université Grenoble Alpes (UGA)
GIPSA-lab / PSD / Equipe ViBS
Bureau B146
Site Ampère
11 rue des Mathématiques
BP 46
F - 38042 GRENOBLE
tel : +33 (0)4 76 57 43 73
mel :<a href="mailto:anne.guerin@gipsa-lab.grenoble-inp.fr">anne.guerin@gipsa-lab.grenoble-inp.fr</a></pre>
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">fieldtrip
 mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C96e66c2e7aad494f806408dd203522e1%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638702134757055527%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=efF2ZJyt6FMpvfeu9juWGamYEj4JuoX0FyioohsSY50%3D&reserved=0" originalsrc="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" shash="IK4yRZAjtWyEpdeF8FcMsSIvxdW3inVgOE0tCschO/r+z3bw7WoM/C9XPcNWzKnN47pfPRpphcMvPUp7wJg3qDA6BEcumRg227LO3czkebD4k+aexEb1NwwSx7GfzPIjznyStWmNVHh8+r4ThL8F85c89xasginurAtfR1ppE2c=" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C96e66c2e7aad494f806408dd203522e1%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638702134757076617%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=%2Bn4wiEhNQRrb9JUEDai7pGxDgNHCUs48DZgOAbwXDnQ%3D&reserved=0" originalsrc="https://doi.org/10.1371/journal.pcbi.1002202" shash="c93ZW4wZeHxT0/bN7QPTgGjk6PPUhfikBF0aa3FbqnQFGitUwSbQP1N6jRz+1CtDXgwNt1lQ+whOzoBpngMRSSnhMqTQw3O/cKNlbqBZb+Y7CxUlXRisTmJBZN/tOtNFMHLo3e2t6Hh2tBW8FWFlDH/uUQ7KdyMoF+85t8rJE9Y=" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">https://doi.org/10.1371/journal.pcbi.1002202</a></div>
</blockquote>
</div>
<br>
</div>
</body>
</html>