<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Courier New \;color\:black";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Courier New \;color\:\#A020F0";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Courier New \;color\:forestgreen";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle20
        {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:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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 bgcolor="white" lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Thanks for your help. You were spot on; now the version is updated it runs perfectly.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Duncan<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span style="color:#1F497D">________________________________________________<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Dr. Duncan Astle,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Programme Leader Track,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">British Academy Research Fellow,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">MRC Cognition and Brain Sciences Unit,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Chaucer Road,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Cambridge.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Duncan.Astle@mrc-cbu.cam.ac.uk<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"> fieldtrip-bounces@science.ru.nl
 [mailto:fieldtrip-bounces@science.ru.nl] <b>On Behalf Of </b>"Jörn M. Horschig"<br>
<b>Sent:</b> 13 September 2012 12:11<br>
<b>To:</b> FieldTrip discussion list<br>
<b>Subject:</b> Re: [FieldTrip] Problem with clustering across electrode neighbours<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hey Duncan,<br>
<br>
it looks pretty much like you are using an old FieldTrip version with a new neighbourhood-structure. Could you check the with the most recent version again?
<br>
Some months (about a year?) ago we changed the neighbour definition from cell arrays to structure arrays, so any attempt to access cfg.neighbours{i} will fail, cause it has to be cfg.neighbours(i) instead. But as I already said, this has been changed quite
 some time back in the past :) <br>
<br>
Essentially, your code is fine, but some note that cfg.neighbourdist should be a scalar, not the string 'number', but only if cfg.method='distance'. If you choose cfg.method = 'template' then cfg.neighbourdist is not used, cause a template is loaded.<br>
<br>
Best,<br>
Jörn<br>
<br>
On 9/13/2012 12:46 PM, Duncan Astle wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">Dear Fieldtrippers,<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">I am rather new to this, but am attempting to do some cluster stats on my ERP sensor level data. It is working well, and I can cluster across time, but I can’t get it to cluster across electrode locations. I think it is because of a mistake
 that I am making in my ‘neighbours’ file, although it looks fine when I inspect it. This is the error message that I get:<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">??? Cell contents reference from a non-cell array object.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Error in ==> clusterstat>makechanneighbstructmat at 520<o:p></o:p></p>
<p class="MsoNormal">    [seld] = match_str(cfg.channel, cfg.neighbours{chan}.label);<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Error in ==> clusterstat at 60<o:p></o:p></p>
<p class="MsoNormal">    channeighbstructmat = makechanneighbstructmat(cfg);<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Error in ==> statistics_montecarlo at 322<o:p></o:p></p>
<p class="MsoNormal">  [stat, cfg] = clusterstat(cfg, statrand, statobs,'issource',issource);<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Error in ==> statistics_wrapper at 285<o:p></o:p></p>
<p class="MsoNormal">    [stat, cfg] = statmethod(cfg, dat, cfg.design, 'issource',issource);<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Error in ==> ft_timelockstatistics at 119<o:p></o:p></p>
<p class="MsoNormal">[stat, cfg] = statistics_wrapper(cfg, varargin{:});<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Can anyone spot what I am doing wrong?<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">This is how I make my neighbour file:<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">cfg = [];</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">cfg.layout      =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'EEG1010.lay'</span><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">;
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:forestgreen","serif"">% try 'distance' as well</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">cfg.feedback    =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'yes'</span><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">;
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:forestgreen","serif"">% show a neighbour plot
</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">cfg.method      =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'template'</span><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">cfg.neighbourdist =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'number'</span><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">cfg.template      =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'EEG1010_neighb.mat'</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">cfg.channel       =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'all'</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">cfg.feedback      =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'yes'</span><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">neighbours      = ft_prepare_neighbours(cfg, Load5Hard);
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:forestgreen","serif"">% define neighbouring channels   
</span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">This is how I then try the stats:<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg = [];</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.channel     =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'all'</span><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.latency     = [0.1 1.3];</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.avgovertime =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'no'</span><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.avgoverchannel =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'no'</span><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.parameter   =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'individual'</span><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.method      =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'montecarlo'</span><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.statistic   =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'depsamplesT'</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.alpha       = 0.05;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.correctm    =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'cluster'</span><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">;
</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.correcttail =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'prob'</span><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.numrandomization = 1000;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.feedback    =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'yes'</span><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">;
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:forestgreen","serif"">% show a neighbour plot
</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.neighbours  = neighbours;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">   
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:forestgreen","serif"">%cfg.minnbchan        = 2;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.clusterstatistic =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'maxsum'</span><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.clusterthreshold =
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:#A020F0","serif"">'nonparametric'</span><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.clusteralpha     = 0.01;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.clustercritval   = 0.06;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">  
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:forestgreen","serif"">% cfg.clustertail      = 0;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.tail = 0;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    Nsub = 19;</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.design(1,1:2*Nsub)  = [ones(1,Nsub) 2*ones(1,Nsub)];</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.design(2,1:2*Nsub)  = [1:Nsub 1:Nsub];</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.ivar                = 1;
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:forestgreen","serif"">% the 1st row in cfg.design contains the independent variable</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">    cfg.uvar                = 2;
</span><span style="font-size:10.0pt;font-family:"Courier New ;color:forestgreen","serif"">% the 2nd row in cfg.design contains the subject number</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">   
</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">       </span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New ;color:black","serif"">[stat] = ft_timelockstatistics(cfg, Load3Hard, Load3Easy)</span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Any suggestions very gratefully received. <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Duncan<o:p></o:p></p>
<p class="MsoNormal">________________________________________________<o:p></o:p></p>
<p class="MsoNormal">Dr. Duncan Astle,<o:p></o:p></p>
<p class="MsoNormal">Programme Leader Track,<o:p></o:p></p>
<p class="MsoNormal">British Academy Research Fellow,<o:p></o:p></p>
<p class="MsoNormal">MRC Cognition and Brain Sciences Unit,<o:p></o:p></p>
<p class="MsoNormal">Chaucer Road,<o:p></o:p></p>
<p class="MsoNormal">Cambridge.<o:p></o:p></p>
<p class="MsoNormal"><a href="mailto:Duncan.Astle@mrc-cbu.cam.ac.uk">Duncan.Astle@mrc-cbu.cam.ac.uk</a><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif""><br>
<br>
<br>
<o:p></o:p></span></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>fieldtrip mailing list<o:p></o:p></pre>
<pre><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><o:p></o:p></pre>
<pre><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif""><br>
<br>
<br>
<o:p></o:p></span></p>
<pre>-- <o:p></o:p></pre>
<pre>Jörn M. Horschig<o:p></o:p></pre>
<pre>PhD Student<o:p></o:p></pre>
<pre>Donders Institute for Brain, Cognition and Behaviour <o:p></o:p></pre>
<pre>Centre for Cognitive Neuroimaging<o:p></o:p></pre>
<pre>Radboud University Nijmegen <o:p></o:p></pre>
<pre>Neuronal Oscillations Group<o:p></o:p></pre>
<pre>FieldTrip Development Team<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>P.O. Box 9101<o:p></o:p></pre>
<pre>NL-6500 HB Nijmegen<o:p></o:p></pre>
<pre>The Netherlands<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Contact:<o:p></o:p></pre>
<pre>E-Mail: <a href="mailto:jm.horschig@donders.ru.nl">jm.horschig@donders.ru.nl</a><o:p></o:p></pre>
<pre>Tel:    +31-(0)24-36-68493<o:p></o:p></pre>
<pre>Web: <a href="http://www.ru.nl/donders">http://www.ru.nl/donders</a><o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Visiting address:<o:p></o:p></pre>
<pre>Trigon, room 2.30<o:p></o:p></pre>
<pre>Kapittelweg 29<o:p></o:p></pre>
<pre>NL-6525 EN Nijmegen<o:p></o:p></pre>
<pre>The Netherlands<o:p></o:p></pre>
</div>
</body>
</html>