<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Valentina,
<div class=""><br class="">
</div>
<div class="">Thanks for your quite extensive report. Good that you delved into the code to hunt for the cause of the problem yourself. What’s not clear from your description, is whether the data are consistent with the neighbour specification to begin with.
Importantly, the data.label needs to overlap with the neighbours.label (and the entries in neighblabel). Only if this condition is fulfilled, FieldTrip will be able to create an channel adjacency matrix from the neighbours structure array. You describe that
the adjacency matrix is in line with your expectations, i.e. 129x129, so it sounds as if all is good with respect to how the neighbours have been defined.</div>
<div class=""><br class="">
</div>
<div class="">I don’t understand why findcluster wants ’spatdimneighbstructmat’ to be 1x1. This can only be the consequence of the fact that the size of the onoff variable (in findcluster) is not according to the expectations. It might be worthwile to look
into the consistency of the input data that resulted from the besa2fieldtrip conversion.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 7 Mar 2022, at 11:43, Valentina Jelinčić via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
Hi everyone,<br class="">
</div>
<div style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
<br class="">
</div>
<div style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
I am a total beginner in FT and have been trying to run a cluster-based permutation test (between-subjects) on time-frequency data exported from BESA Connectivity. I used the function besa2fieldtrip on .tfc data, which according to this tutorial <a href="https://urldefense.com/v3/__https://www.fieldtriptoolbox.org/getting_started/besa/*reading-in-data-files-from-besa__;Iw!!HJOPV4FYYWzcc1jazlU!_UNNbfTgZEb7EhR4onWzNj91HtI8L0ICGdFK0ymLihNBDFzw_BQoywdnr8TzahzmFsNWb-nrxotaqa2ttdOltX2zSbAMxzn2vPZsCw$" title="https://www.fieldtriptoolbox.org/getting_started/besa/#reading-in-data-files-from-besa
Ctrl+Click or tap to follow the link" class="">https://www.fieldtriptoolbox.org/getting_started/besa/#reading-in-data-files-from-besa</a>should
produce output similar to ft_freqanalysis. I did have to do some tweaking to get the 2 power spectra to be 4-D matrices with the following dimord: subj_chan_freq_time. I defined my configuration using this tutorial <a href="https://urldefense.com/v3/__https://www.fieldtriptoolbox.org/tutorial/cluster_permutation_freq/*permutation-test__;Iw!!HJOPV4FYYWzcc1jazlU!_UNNbfTgZEb7EhR4onWzNj91HtI8L0ICGdFK0ymLihNBDFzw_BQoywdnr8TzahzmFsNWb-nrxotaqa2ttdOltX2zSbAMxzn0egYfmA$" class="">https://www.fieldtriptoolbox.org/tutorial/cluster_permutation_freq/#permutation-test</a>,
leaving almost all the settings as-is.<br class="">
</div>
<div style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
<br class="">
</div>
<div style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
When I run ft_freqstatistics, I get the following readout:<br class="">
<br class="">
<div class="">Error using findcluster (line 66)</div>
<div class="">invalid dimension of spatdimneighbstructmat</div>
<div class=""><br class="">
</div>
<div class="">Error in clusterstat (line 214)</div>
<div class=""> posclusobs = findcluster(tmp, connmat, cfg.minnbchan);</div>
<div class=""><br class="">
</div>
<div class="">Error in ft_statistics_montecarlo (line 363)</div>
<div class=""> [stat, cfg] = clusterstat(cfg, statrand, statobs);</div>
<div class=""><br class="">
</div>
<div class="">Error in ft_freqstatistics (line 193)</div>
<div class=""> [stat, cfg] = statmethod(cfg, dat, design);<br class="">
</div>
<br class="">
</div>
<div style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
I turned on debugging, and the error happens on this line:<br class="">
</div>
<div style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
if ~ismatrix(spatdimneighbstructmat) || ~all(size(spatdimneighbstructmat)==spatdimlength)</div>
<div style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
ft_error('invalid dimension of spatdimneighbstructmat');</div>
<div style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
end<br class="">
</div>
<div style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
<br class="">
</div>
<div style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
It seems that findcluster wants the size of my <span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class="">s</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class="">pa</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class="">tdimneighbstructmat
to be 1 (size assigned to spatdimlength earlier in the function), but it is a 129*129 matrix (EGI 129 channel net). I find this odd, since the function documentation states:<br class="">
</span>
<div class="">"The neighbourhood structure for the first dimension is specified using <span style="font-size: 12pt;" class="">s</span><span style="font-size: 12pt;" class="">p</span><span style="font-size: 12pt;" class="">atdimneighbstructmat, which is a 2D
(N1xN1) matrix. Each row and each column</span><span style="font-size: 12pt;" class=""> corresponds to a channel (combination) along the first dimension and along that </span><span style="font-size: 12pt;" class="">row/column, elements with "1" define the
neighbouring channel(s) (combinations)."</span></div>
<div class=""><span style="font-size: 12pt;" class=""><br class="">
</span></div>
<div class=""><span style="font-size: 12pt;" class="">From that description, it seems that my spatdimneighbstructmat is correct, so I have trouble interpreting this error or figuring out what I should change.</span></div>
<div class=""><span style="font-size: 12pt;" class=""><br class="">
</span></div>
<div class=""><span style="font-size: 12pt;" class="">All that said, I will say that I am still unsure what the "data" parameter in ft_prepare_neighbours should be. At the moment, I am putting the channel configuration in there, but this may be wrong. </span></div>
<span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);" class=""> </span><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px; caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
Does anyone have experience with BESA data and/or defining neighbour structure for EGI nets, and wouldn't mind having a look at my data/configuration? Thank you very much in advance!<br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px; caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
<br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px; caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
All the best,<br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px; caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
Valentina<br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px; caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
<br class="">
</div>
<div id="Signature" style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
<div name="divtagdefaultwrapper" style="font-family: Calibri, Arial, Helvetica, sans-serif; margin: 0px;" class="">
<font color="#808080" class=""><font size="2" class="">Valentina Jelinčić, M.Sc.</font></font>
<div class=""><font size="2" color="#808080" class="">PhD student | Research Group Health Psychology | KU Leuven</font></div>
<div class=""><font size="2" color="#808080" class="">Tiensestraat 102, room 02.86</font></div>
<div class=""><font size="2" color="#808080" class="">3000 Leuven, Belgium</font></div>
</div>
</div>
<span style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none; float: none; display: inline !important;" class="">fieldtrip
mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
<a href="https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!_UNNbfTgZEb7EhR4onWzNj91HtI8L0ICGdFK0ymLihNBDFzw_BQoywdnr8TzahzmFsNWb-nrxotaqa2ttdOltX2zSbAMxznL2SUpwg$" style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class="">https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!_UNNbfTgZEb7EhR4onWzNj91HtI8L0ICGdFK0ymLihNBDFzw_BQoywdnr8TzahzmFsNWb-nrxotaqa2ttdOltX2zSbAMxznL2SUpwg$</a><span style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none; float: none; display: inline !important;" class=""><span class="Apple-converted-space"> </span></span><br style="caret-color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration: none;" class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>