<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Afshin,
<div class=""><br class="">
</div>
<div class="">
<div>
<blockquote type="cite" class="">
<div class="">
<div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class=""><o:p class=""> </o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">I face two errors:<o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class=""><o:p class=""> </o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">first at ft_math function:<o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class=""><o:p class=""> </o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">Error using ft_math (line 151)<o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">the requested parameter is not present in the data</span></pre>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>As the error indicates, the requested parameter ‘avg’ is apparently not in the data. In other words, the timelock1/2 structures shouldn't have an ‘avg’ field, causing ft_math to complain. The reason for this is  that the example script pre-dates some changes
 to the fieldtrip code base, which caused the ‘avg’ field to disappear if ft_timelockanalysis is called with cfg.keeptrials = ‘yes’. Probably, if you use cfg.parameter = ‘trial’, rather than ‘avg’ in your call to ft_math, it’ll work.</div>
<div><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class=""><o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">Error in Nonparametric_statistical_testingEEGandMEG_data (line 45)<o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">difference = ft_math(cfg, timelock1, timelock2); % line 137 of ft_datatype_timelock removes the fields<o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class=""><o:p class=""> </o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">and if I comment that line out, I face another error at ft_timelcokstatistics<o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class=""><o:p class=""> </o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">Error using chol<o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">Matrix must be square.<o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class=""><o:p class=""> </o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">Error in montecarlo (line 13)<o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">R = chol(Sigma);   % Y = R^{-T}X has covariance I</span></pre>
</div>
</blockquote>
<div><br class="">
</div>
<div>For some reason, you end up in a function called ‘montecarlo’,  which is incorrect, since you should have ended up in ft_statistics_montecarlo. The cause of all this is probably that the folder that has the ‘montecarlo’ function is higher on the matlab
 search path than the fieldtrip folder.</div>
<div><br class="">
</div>
<div>Jan-Mathijs</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div>
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
J.M.Schoffelen, MD PhD<br class="">
Senior Researcher, VIDI-fellow - PI, language in interaction<br class="">
Telephone: +31-24-3614793</div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Physical location: room 00.028</div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands<br class="">
<br class="">
<br class="">
</div>
</div>
</div>
</div>
</div>
<div><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class=""><o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class=""><o:p class=""> </o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">Error in ft_timelockstatistics (line 185)<o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">  [stat] = statmethod(cfg, dat, design);<o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class=""><o:p class=""> </o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">Error in Nonparametric_statistical_testingEEGandMEG_data (line 63)<o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">stat = ft_timelockstatistics(cfg, timelock1, timelock2);<o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class=""><o:p class=""> </o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">Any comment?<o:p class=""></o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class=""><o:p class=""> </o:p></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: 'Courier New'; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""><span lang="EN-US" style="font-size: 12pt;" class="">Best regards,<o:p class=""></o:p></span></pre>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<b class=""><span lang="EN-US" class="">Associate Prof. Afshin Samani, PhD<o:p class=""></o:p></span></b></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" style="color: rgb(31, 73, 125);" class="">Sport Sciences<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" style="font-size: 10pt; color: rgb(31, 73, 125);" class="">Dept. of Health Science and Technology</span><span lang="EN-US" style="color: rgb(31, 73, 125);" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; color: rgb(31, 73, 125);" class="">Aalborg University, Aalborg</span><span style="color: rgb(31, 73, 125);" class=""><o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; color: rgb(31, 73, 125);" class="">Denmark</span><span style="font-size: 9pt; color: rgb(31, 73, 125);" class=""><o:p class=""></o:p></span></div>
<p class="MsoNormal" style="margin: 0cm 0cm 9pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style="font-size: 9pt; color: rgb(31, 73, 125);" class=""><span id="cid:image001.png@01D4775E.B125C260"><image001.png></span></span><span style="" class=""><o:p class=""></o:p></span></p>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
</div>
<span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">fieldtrip
 mailing list</span><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="color: rgb(149, 79, 114); text-decoration: underline; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" style="color: rgb(149, 79, 114); text-decoration: underline; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://doi.org/10.1371/journal.pcbi.1002202</a></blockquote>
</div>
<br class="">
</div>
<br class="">
<br class="">
<div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<br class="">
</div>
</div>
</div>
</div>
</body>
</html>