<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<div>Hi everyone,<br>
</div>
<div><br>
</div>
<div>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://www.fieldtriptoolbox.org/getting_started/besa/#reading-in-data-files-from-besa" title="https://www.fieldtriptoolbox.org/getting_started/besa/#reading-in-data-files-from-besa
Ctrl+Click or tap to follow the link">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://www.fieldtriptoolbox.org/tutorial/cluster_permutation_freq/#permutation-test">https://www.fieldtriptoolbox.org/tutorial/cluster_permutation_freq/#permutation-test</a>​,
 leaving almost all the settings as-is.<br>
</div>
<div><br>
</div>
<div>When I run ft_freqstatistics, I get the following readout:<br>
<br>
<div>Error using findcluster (line 66)</div>
<div>invalid dimension of spatdimneighbstructmat</div>
<div><br>
</div>
<div>Error in clusterstat (line 214)</div>
<div>  posclusobs = findcluster(tmp, connmat, cfg.minnbchan);</div>
<div><br>
</div>
<div>Error in ft_statistics_montecarlo (line 363)</div>
<div>  [stat, cfg] = clusterstat(cfg, statrand, statobs);</div>
<div><br>
</div>
<div>Error in ft_freqstatistics (line 193)</div>
<div>  [stat, cfg] = statmethod(cfg, dat, design);<br>
</div>
<br>
</div>
<div>I turned on debugging, and the error happens on this line:<br>
</div>
<div>if ~ismatrix(spatdimneighbstructmat) || ~all(size(spatdimneighbstructmat)==spatdimlength)</div>
<div>  ft_error('invalid dimension of spatdimneighbstructmat');</div>
<div>end<br>
</div>
<div><br>
</div>
<div>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);">s</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">pa</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">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>
</span>
<div>"The neighbourhood structure for the first dimension is specified using <span style="font-size: 12pt;">s</span><span style="font-size: 12pt;">p</span><span style="font-size: 12pt;">atdimneighbstructmat, which is a 2D (N1xN1) matrix. Each row and each column</span><span style="font-size: 12pt;"> corresponds
 to a channel (combination) along the first dimension and along that </span><span style="font-size: 12pt;">row/column, elements with "1" define the neighbouring channel(s) (combinations)."</span></div>
<div><span style="font-size: 12pt;"><br>
</span></div>
<div><span style="font-size: 12pt;">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><span style="font-size: 12pt;"><br>
</span></div>
<div><span style="font-size: 12pt;">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);"> </span><br>
</div>
<p>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>
</p>
<p><br>
</p>
<p>All the best,<br>
</p>
<p>Valentina<br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<font color="#808080"><font size="2">Valentina Jelinčić, M.Sc.</font> </font>
<div><font size="2" color="#808080">PhD student | Research Group Health Psychology | KU Leuven</font></div>
<div><font size="2" color="#808080">Tiensestraat 102, room 02.86</font></div>
<div><font size="2" color="#808080">3000 Leuven, Belgium</font></div>
</div>
</div>
</body>
</html>