<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
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
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Hi David,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></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?). <o:p></o:p></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.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>All the best,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Jörn<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span style='font-size:9.0pt;font-family:"Verdana",sans-serif;color:#1F497D;mso-fareast-language:NL'>--</span></b><b><span style='font-size:9.0pt;font-family:"Verdana",sans-serif;color:#255A9E;mso-fareast-language:NL'><br>Jörn M. Horschig, PhD</span></b><span style='font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264;mso-fareast-language:NL'>, 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;mso-fareast-language:NL'><o:p></o:p></span></b></p></div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></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<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></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<o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'><o:p> </o:p></span></p><div><div><div><div><div><div class=MsoNormal align=center style='text-align:center'><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'><hr size=2 width="100%" align=center></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<o:p></o:p></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<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:#003366'>University of Oxford<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:#003366'>Level 6, West Wing<o:p></o:p></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<o:p></o:p></span></p></div></div></div><p class=MsoNormal><u><span lang=DE style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:#003366'>Tel:</span></u><span lang=DE style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:#003366'> +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"><span lang=DE>david.pedrosa@ndcn.ox.ac.uk</span></a></span><span lang=DE style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:#333333'><br></span><span lang=DE style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'><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 lang=DE style='font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black'><o:p></o:p></span></p></div></div></div></div></div></div></div></div></body></html>