<div class="gmail_quote">
<div>Hi Fieldtrippers,</div>
<div> </div>
<div>I am trying to perform a group-level comparison of 2 conditions across 10 subjects based on the DTF connectivity. For the time being, we are looking at the DTF for a subset of frequencies (alpha) and choosing the avgoverfreq option which gives us a 4096 x 1 matrix since we are looking at 64 x 64 channels. Using ft_freqstatistics, I noticed that it will throw an error explaining that there is not yet an implementation for data with channelcmb for a cluster analysis so I took it upon myself to identify channel pairs which should be considered neighbors and build a new neighbor structure prior to running ft_freqstatistics. To do that, I took the basic neighbor structure for 64 channels and then created a new neighbor structure of 4096 channel pairs based on the code below:</div>
<div> </div>
<div><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">for i=1:4096</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"> label{i,1} = [dtf.</span><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">labelcmb{i,1},'_',</span><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">dtf.labelcmb{i,2}];</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">end</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
</div>
<div> </div>
<div>labelcmb = dtf.labelcmb;</div>
<div><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">chans=64;</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
</div>
<div> </div>
<div>%Identify the channel pairs which are neighbors with the target channel<br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">NBtarget = {};</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">for ch=1:chans^2</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"> NBtarget(ch).label = label{ch};<span> </span></span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"> target = find(cellfun(@(x) strcmp(labelcmb{ch,1},x),{</span><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">neighbours(:).label}) ==1) ;</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"> tempnb = cellfun(@(x) strcat(x,['_' labelcmb{ch,2}]),{neighbours(</span><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">1,target).neighblabel},'</span><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">UniformOutput',0);</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"> NBtarget(ch).neighblabel = tempnb{:};</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">end</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
</div>
<div><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">%Identify the channel pairs which are neighbors with the reference channel<br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">NBref = {};</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">for ch=1:chans^2</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"> NBref(ch).label = label{ch};<span> </span></span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"> target = find(cellfun(@(x) strcmp(labelcmb{ch,2},x),{</span><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">neighbours(:).label}) ==1) ;</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"> tempnb = cellfun(@(x) strcat([labelcmb{ch,1} '_'],x),{neighbours(1,target).</span><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">neighblabel},'UniformOutput',</span><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">0);</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"> NBref(ch).neighblabel = tempnb{:};</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">end</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
%Append both sets of neighbors (ref and target)</div>
<div><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">NBboth= {};</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">for ch=1:chans^2</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"> NBboth(ch).label = label{ch};<span> </span></span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"> NBboth(ch).neighblabel = [NBref(ch).neighblabel; NBtarget(ch).neighblabel];</span><br style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;FONT:12px arial,sans-serif;WHITE-SPACE:normal;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">
<span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">end</span></div>
<div><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"></span> </div>
<div><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"></span> </div>
<div><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">This seems to work and the clustering method proceeds without error. My question is the following: is this the proper way to utilize the clustering method using ft_freqstatistics on connectivity data or am I missing something?</span></div>
<div><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px"></span> </div>
<div><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">Thanks,</span></div>
<div><span style="TEXT-TRANSFORM:none;TEXT-INDENT:0px;DISPLAY:inline!important;FONT:12px arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(34,34,34);WORD-SPACING:0px">-Tony</span></div></div>
<br>