<html 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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Courier;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
p.p1, li.p1, div.p1
        {mso-style-name:p1;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:7.5pt;
        font-family:Courier;
        color:forestgreen;}
p.p2, li.p2, div.p2
        {mso-style-name:p2;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:7.5pt;
        font-family:Courier;}
p.p3, li.p3, div.p3
        {mso-style-name:p3;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:7.5pt;
        font-family:Courier;}
span.s1
        {mso-style-name:s1;
        color:#A020F0;}
span.s2
        {mso-style-name:s2;
        color:black;}
span.s3
        {mso-style-name:s3;
        color:forestgreen;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-NZ" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">I have a dataset from an experiment where 12 participants were exposed to 3 levels of nitrous oxide, while I measured their EEG. I also have a baseline recording. I took for each exposure (and
 baseline) a 1 minute sample for further analysis. I want to do source localization to better understand  which parts of the brain are involved. I don’t have MRI scans of my participants, so I used the standard MRI and BEM. I would like to thanks the persons
 who made the various manuals and analysis examples on the website, as they helped me tremendously to do this analysis.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">After cleaning and preprocessing, I combined the datasets into one for further analysis. I also chose to make 5 sec “trials” for further analysis. For this source analysis I loaded the data of
 1 exposure and the baseline data, to compare them.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="p1">        %Calculate the channel covariance matric<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg = [];<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.covariance =
<span class="s1">'yes'</span>;<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.covariancewindow =
<span class="s1">'all'</span>;<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.keeptrials<span class="apple-converted-space"> 
</span>= <span class="s1">'yes'</span>;<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>timelock = ft_timelockanalysis(cfg, data_filt);<o:p></o:p></p>
<p class="p3"><span class="apple-converted-space">        </span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space">        </span>%Global filter<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg = [];<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.headmodel = vol;<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.elec = elec_aligned;<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.grid = grid;<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.method = <span class="s1">
'lcmv'</span>;<o:p></o:p></p>
<p class="p1"><span class="apple-converted-space">        </span><span class="s2">cfg.lcmv.projectnoise=</span><span class="s1">'yes'</span><span class="s2">;
</span>%needed for neural activity index<o:p></o:p></p>
<p class="p1"><span class="apple-converted-space">        </span><span class="s2">cfg.lcmv.fixedori =
</span><span class="s1">'yes'</span><span class="s2">;</span><span class="apple-converted-space"> 
</span>%Project onto largest variance orientation<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.lcmv.keepfilter =
<span class="s1">'yes'</span>; <span class="s3">%Keep the beamformer weights</span><o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.lcmv.lambda =
<span class="s1">'5%'</span>; <span class="s3">%Regularise a little</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space">        </span><span class="s2">cfg.rawtrial</span><span class="apple-converted-space">   
</span><span class="s2">= </span><span class="s1">'yes'</span><span class="s2">;</span><span class="apple-converted-space">     
</span>% project each single trial through the filter.<span class="apple-converted-space"> </span><o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.keeptrials<span class="apple-converted-space"> 
</span>= <span class="s1">'yes'</span>;<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>source = ft_sourceanalysis(cfg, timelock);<o:p></o:p></p>
<p class="p3"><span class="apple-converted-space">                </span><o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg = [];<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.dim <span class="apple-converted-space">
        </span>= source.dim;<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.method<span class="apple-converted-space">     
</span>= <span class="s1">'montecarlo'</span>;<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.statistic <span class="apple-converted-space">
  </span>= <span class="s1">'ft_statfun_indepsamplesT'</span>;<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.parameter <span class="apple-converted-space">
  </span>= <span class="s1">'pow'</span>;<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.correctm<span class="apple-converted-space">   
</span>= <span class="s1">'cluster'</span>;<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.numrandomization = 1000;<o:p></o:p></p>
<p class="p1"><span class="apple-converted-space">        </span><span class="s2">cfg.alpha
</span><span class="apple-converted-space">      </span><span class="s2">= 0.05; </span>
% note that this only implies single-sided testing<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.tail<span class="apple-converted-space">       
</span>= 0;<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.design(1,:) = [1:nTrials 1:nTrials];<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>cfg.design(2,:) = [ones(1,nTrials) ones(1,nTrials).*2];<o:p></o:p></p>
<p class="p1"><span class="apple-converted-space">        </span><span class="s2">cfg.uvar</span><span class="apple-converted-space">       
</span><span class="s2">= 1; </span>% row of design matrix that contains unit variable (in this case: trials)<o:p></o:p></p>
<p class="p1"><span class="apple-converted-space">        </span><span class="s2">cfg.ivar</span><span class="apple-converted-space">       
</span><span class="s2">= 2; </span>% row of design matrix that contains independent variable (the conditions)<span class="apple-converted-space">       </span><o:p></o:p></p>
<p class="p2"><span class="apple-converted-space">        </span>stat = ft_sourcestatistics(cfg, source);<o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">After the source analysis the source statistics script calls the checkdata script and I get the following error:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Index exceeds array bounds.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Error in ft_datatype_source (line 183)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">            val{indx(k)}(1,:,:,:) = dat{indx(k)};<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Error in ft_checkdata (line 278)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">  data = ft_datatype_source(data);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Error in ft_sourcestatistics (line 94)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">  varargin{i} = ft_checkdata(varargin{i}, 'datatype', 'source', 'feedback', 'no');<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Error in sourcelocalisation_N2O (line 114)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">        stat = ft_sourcestatistics(cfg, source);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">The source struct has the following content:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">      time: [1×15360 double]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">       dim: [24 31 25]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">    inside: [18600×1 logical]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">       pos: [18600×3 double]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">    method: 'rawtrial'<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">     trial: [1×24 struct]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">        df: 24<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">       cfg: [1×1 struct]<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">With source.trial:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">  1×24 struct array with fields:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">    ori<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">    pow<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">    mom<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">    noise<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">    filter<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">    label<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">    filterdimord<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">I would like your help to understand the error and how to fix it.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Xavier Vrijdag<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
</body>
</html>