<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style>
<!--
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
@font-face
        {font-family:Verdana}
@font-face
        {font-family:Tahoma}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
p
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif}
span.EmailStyle18
        {font-family:"Calibri",sans-serif;
        color:#1F497D}
.MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:1.0in 1.0in 1.0in 1.0in}
-->
</style><style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1" lang="EN-US" link="blue" vlink="purple">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi Jorn,
<br>
<br>
thanks for the fast help! It was as you suggested. <br>
<br>
Now, I have a different issue someone might be able to help me with. When I do the analyses as explained, fieldtrip tells me that cluster stats are not possible as there are no labels in the data. This of course makes sense as it is coherence data with a labelcmb
 instead of label structure. Is there a way to do the cluster correction in fieldtrip with coherence data anyway? Or would it make more sense to take the raw fourier data into ft_freqstatistics and do the stats as desired in a custom statfun function with the
 corrections as wanted, e.g. similar to indepsamplesZcoh but for between subjects analyses?
<br>
<br>
Best<br>
David <br>
<br>
<br>
<div>
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-size:13px">
<hr>
<font face="Tahoma" size="2"><font color="003366">Dr. David Pedrosa<br>
</font></font><font face="Tahoma" color="003366" size="2"><br>
Clinical Research Fellow</font><font face="Tahoma" color="003366" size="2"><br>
</font><font face="Tahoma" color="003366" size="2"><span dir="ltr" style="font-size:10pt">
<div>
<div><span style="font-size:13px">
<div><font size="2"><span style="font-size:10pt">Medical Research Council Brain Network Dynamics Unit at the University of Oxford<br>
Nuffield Department of Clinical Neurosciences</span></font></div>
<div>University of Oxford</div>
<div>Level 6, West Wing</div>
<div>John Radcliffe Hospital, OX3 9DU<br>
</div>
</span></div>
</div>
</span></font><font face="Tahoma" color="003366" size="2"><span style="font-size:10pt"><u>Tel:</u>
</span></font><font face="Tahoma" size="2"><span style="font-size:10pt"><font color="003366">+44 (0)1865 572490<br>
<u>E-Mail:</u> </font><font color="333333">david.pedrosa@ndcn.ox.ac.uk<br>
</font></span></font><font size="2"><span style="font-size:10pt"><br>
<a href="https://owa.nexus.ox.ac.uk/owa/redir.aspx?C=E40BwPuNq0uXQGSOPDW39AmtYlwBR9IIjsI0PRu9uuTE46jeZnqjmG6XP02rBAUiF1EnCJtn3UU.&URL=http%3a%2f%2fwww.mrcbndu.ox.ac.uk%2f" target="_blank">http://www.mrcbndu.ox.ac.uk/</a></span></font><br>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF281358"><font face="Tahoma" color="#000000" size="2"><b>Von:</b> fieldtrip-bounces@science.ru.nl [fieldtrip-bounces@science.ru.nl]" im Auftrag von "Jörn M. Horschig [jorn@artinis.com]<br>
<b>Gesendet:</b> Dienstag, 1. März 2016 16:20<br>
<b>An:</b> 'FieldTrip discussion list'<br>
<b>Betreff:</b> Re: [FieldTrip] Question on coherence stats at sensor level<br>
</font><br>
</div>
<div></div>
<div>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri",sans-serif; color:#1F497D">Hi David,</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri",sans-serif; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri",sans-serif; color:#1F497D">The problem is with specifying cfg.statistics = ‘diff’. the ft_xxxstats function work by ‘eval’-ing the content of cfg.statistics. Thus, it runs the built-in
 Matlab function ‘diff’, which is not defined for structs such as FT-data variables, but only for matrices (and cells?).
</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri",sans-serif; color:#1F497D">I saw there is also a ft_statfun_diff, which is probably the one you were aiming to use.  The problem is that internally, the private function ft_getuserfun
 is checking first for the existence of ‘diff’, before it even comes to considering ‘ft_statfun_diff’. Long story short, you can most likely solve your problem by specifying ‘ft_statfun_diff’ instead of ‘diff’, and the FT guys should think about what to do
 with ft_getuserfun.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri",sans-serif; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri",sans-serif; color:#1F497D">All the best,</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri",sans-serif; color:#1F497D">Jörn</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri",sans-serif; color:#1F497D"> </span></p>
<div>
<p class="MsoNormal" style=""><b><span style="font-size:9.0pt; font-family:"Verdana",sans-serif; color:#1F497D">--</span></b><b><span style="font-size:9.0pt; font-family:"Verdana",sans-serif; color:#255A9E"><br>
Jörn M. Horschig, PhD</span></b><span style="font-size:9.0pt; font-family:"Verdana",sans-serif; color:#626264">, Software Engineer<br>
<a href="http://www.artinis.com/" target="_blank"><span style="color:#626264">Artinis Medical Systems</span></a>  |  +31 481 350 980
</span><b><span style="font-size:9.0pt; font-family:"Verdana",sans-serif; color:#255A9E"></span></b></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri",sans-serif; color:#1F497D"> </span></p>
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt; font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt; font-family:"Calibri",sans-serif"> fieldtrip-bounces@science.ru.nl [mailto:fieldtrip-bounces@science.ru.nl]
<b>On Behalf Of </b>David Pedrosa<br>
<b>Sent:</b> Tuesday, March 1, 2016 16:22<br>
<b>To:</b> fieldtrip@science.ru.nl<br>
<b>Subject:</b> [FieldTrip] Question on coherence stats at sensor level</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:"Tahoma",sans-serif; color:black">Dear list,
<br>
<br>
I running analyses on the sensor level with EMG-EEG coherence data and I ran into some problems. Basically my intention is to compare the corticomuscular coherence at rest versus during an activation task. For that, according to some older posts and literature,
 I computed the Z-transformed coherence (after using ft_connectivityanalyses, I manually transformed the cohspctrm data with respect to the dof) which I want to test with a permutation test. Now, when it comes to computing the stats, it gives me the error >>
 Function 'diff' is not supported for class 'struct'. << Would it be more reasonable using another function? Or does anyone have an idea where my problem could be or what I should do instead?<br>
<br>
Here's the used code I use:<br>
<br>
                %% for loop normalizing coherence manually and creating 0-coherence data...          
<br>
                coh_diff{1,1} =  coh_diff_condition{1,1}.cohspctrm = (atanh(x1) - ...<br>
                coh_diff_null{1,1}.cohspctrm(:) =  0;<br>
<br>
                cfg = [];<br>
                cfg.channel                   = {'EEG' 'xEDC'};<br>
                cfg.parameter               = 'cohspctrm';<br>
                cfg.method                   = 'montecarlo';<br>
                cfg.statistic                   = 'diff';<br>
                cfg.tail                          = 0;<br>
                cfg.clustertail                 = 0;<br>
                cfg.alpha                       = .025;<br>
                cfg.numrandomization    = 500;<br>
                <br>
                cfgl = [];<br>
                cfgl.layout  = 'brainamp.sfp';<br>
                cfg.layout   = ft_prepare_layout(cfgl);<br>
                <br>
                cfg.computestat          = 'yes';<br>
                cfg.correctm               = 'cluster';<br>
                cfg.clusteralpha          = .05;<br>
                cfg.clusterstatistic       = 'maxsum';<br>
                cfg.minnbchan            = 2;<br>
                <br>
                cfgn = [];<br>
                cfgn.method = 'distance';<br>
                cfgn.neighbourdist = 40; %in mm<br>
                cfg.neighbours = ft_prepare_neighbours(cfgn,data_epoched_wo);<br>
                <br>
                design = zeros( 2,2*numel(coh_diff));<br>
                design(1,:) = [1:numel(coh_diff), 1:numel(coh_diff_null)];<br>
                design(2,1:numel(coh_diff)) = 1;<br>
                design(2,numel(coh_diff)+1:numel(coh_diff)+numel(coh_diff_null)) = 2;<br>
                <br>
                cfg.design = design;<br>
                cfg.ivar  = 1;<br>
                cfg.uvar = 2;<br>
                [stat] = ft_freqstatistics(cfg, coh_diff{1,1}, coh_diff{1,2}, ..., coh_diff_null{1,12};<br>
<br>
Thanks for your help.<br>
Best,<br>
David</span></p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:"Tahoma",sans-serif; color:black"> </span></p>
<div>
<div>
<div>
<div>
<div>
<div class="MsoNormal" style="text-align:center" align="center"><span style="font-size:10.0pt; font-family:"Tahoma",sans-serif; color:black">
<hr align="center" size="2" width="100%">
</span></div>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:"Tahoma",sans-serif; color:#003366">Dr. David Pedrosa<br>
<br>
Clinical Research Fellow</span></p>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:"Tahoma",sans-serif; color:#003366">Medical Research Council Brain Network Dynamics Unit at the University of Oxford<br>
Nuffield Department of Clinical Neurosciences</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:"Tahoma",sans-serif; color:#003366">University of Oxford</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:"Tahoma",sans-serif; color:#003366">Level 6, West Wing</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:"Tahoma",sans-serif; color:#003366">John Radcliffe Hospital, OX3 9DU</span></p>
</div>
</div>
</div>
<p class="MsoNormal"><u><span style="font-size:10.0pt; font-family:"Tahoma",sans-serif; color:#003366" lang="DE">Tel:</span></u><span style="font-size:10.0pt; font-family:"Tahoma",sans-serif; color:#003366" lang="DE"> +44 (0)1865 572490<br>
<u>E-Mail:</u> </span><span style="font-size:10.0pt; font-family:"Tahoma",sans-serif; color:#333333"><a href="mailto:david.pedrosa@ndcn.ox.ac.uk" target="_blank"><span lang="DE">david.pedrosa@ndcn.ox.ac.uk</span></a></span><span style="font-size:10.0pt; font-family:"Tahoma",sans-serif; color:#333333" lang="DE"><br>
</span><span style="font-size:10.0pt; font-family:"Tahoma",sans-serif; color:black" lang="DE"><br>
</span><span style="font-size:10.0pt; font-family:"Tahoma",sans-serif; color:black"><a href="https://owa.nexus.ox.ac.uk/owa/redir.aspx?C=E40BwPuNq0uXQGSOPDW39AmtYlwBR9IIjsI0PRu9uuTE46jeZnqjmG6XP02rBAUiF1EnCJtn3UU.&URL=http%3a%2f%2fwww.mrcbndu.ox.ac.uk%2f" target="_blank"><span lang="DE">http://www.mrcbndu.ox.ac.uk/</span></a></span><span style="font-size:10.0pt; font-family:"Tahoma",sans-serif; color:black" lang="DE"></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>