<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body dir="auto">
<div>Hey Emilie,</div>
<div><br>
</div>
<div>It looks to me like you are creating clean_data twice. Could you change the first clean_data to a different name and then use that variable name when you call ft_rejectartifact?</div>
<div><br>
</div>
<div>Tyler<br>
<br>
Sent from my iPad</div>
<div><br>
On 28 Aug 2014, at 5:35 pm, "Caspar, Emilie" <<a href="mailto:e.caspar@ucl.ac.uk">e.caspar@ucl.ac.uk</a>> wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>Dear Elke, 
<div><br>
</div>
<div>Thank you for this suggestion. So I have changed following your suggestion : </div>
<div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">clean_data = ft_rejectartifact(cfg,epData);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; "><br>
</div>
<div style="margin: 0px; ">
<div style="margin: 0px; "><font size="2" face="Baskerville">89 trials marked as GOOD, 11 trials marked as BAD</font></div>
<div style="margin: 0px; "><font size="2" face="Baskerville">66 channels marked as GOOD, 0 channels marked as BAD</font></div>
<div style="margin: 0px; "><font size="2" face="Baskerville">the following trials were removed: 13, 24, 29, 32, 51, 59, 61, 68, 86, 95, 99</font></div>
</div>
<div style="margin: 0px; font-size: 12px; font-family: Courier; min-height: 14px; ">
<br>
</div>
<div style="margin: 0px; min-height: 14px; ">
<div style="font-family: Courier; font-size: 10px; margin: 0px; ">avgFC = ft_timelockanalysis(cfg, clean_data);</div>
<div style="font-family: Courier; font-size: 12px; "><br>
</div>
<div style="font-family: Courier; font-size: 12px; ">However, still the same problem : the averaging is always on the 100 trials.</div>
<div>
<div><font face="Courier">the input is raw data with 66 channels and 100 trials</font></div>
<div><font face="Courier">averaging trials</font></div>
<div><font face="Courier">averaging trial 100 of 100</font></div>
</div>
<div style="font-family: Courier; font-size: 12px; "><br>
</div>
<div style="font-family: Courier; font-size: 12px; ">Emilie</div>
<div><font face="Courier"><br>
</font></div>
<div><font face="Courier">--------</font></div>
<div><font face="Courier"><br>
</font></div>
<div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cfg             = [];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
% cfg.channel     = [65:66];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cfg.alim        = 100;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cfg.keepchannel =
<span style="color: #b245f3">'yes'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cfg.layout      =
<span style="color: #b245f3">'biosemi64.lay'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
% cfg.method      = 'summary';</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
% cfg.method      = 'trial';</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cfg.method      =
<span style="color: #b245f3">'channel'</span>; </div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cfg.metric      =
<span style="color: #b245f3">'var'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
<span style="color: #000000">[clean_data]    = ft_rejectvisual(cfg, epData);</span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
<span style="color: #000000">cfg.artfctdef.reject = </span><span style="color: #b245f3">'complete'</span><span style="color: #000000">; </span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
<span style="color: #000000">cfg.artfctdef.feedback = </span><span style="color: #b245f3">'yes'</span><span style="color: #000000">; </span></div>
</div>
<div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">clean_data = ft_rejectartifact(cfg,epData);</div>
</div>
<div><br>
</div>
<div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">avgFC = ft_timelockanalysis(cfg, clean_data);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">ft_singleplotER(cfg,avgFC);</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><font face="Courier"><br>
</font></div>
</div>
<div apple-content-edited="true">
<div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<p class="MsoNormal"><span lang="FR">---------------------------------------------<o:p></o:p></span></p>
<p class="MsoNormal"><b><span lang="FR">Emilie Caspar<o:p></o:p></span></b></p>
<div><span lang="FR"> </span><br class="webkit-block-placeholder">
</div>
<p class="MsoNormal"><span lang="FR">Aspirante FNRS - Ph.D. Student <o:p></o:p></span></p>
<div><span lang="FR"> </span><br class="webkit-block-placeholder">
</div>
<p class="MsoNormal"><span lang="FR">Consciousness, Cognition & Computation Group (CO3)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR">Centre de Recherche Cognition et Neurosciences (CRCN)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR">ULB Neurosciences Institute (UNI)<o:p></o:p></span></p>
<div><span lang="FR"> </span><br class="webkit-block-placeholder">
</div>
<p class="MsoNormal"><span lang="FR">Université Libre de Bruxelles <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR">Av. F.-D. Roosevelt, 50 <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR">1050 Bruxelles <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR">BELGIUM <o:p></o:p></span></p>
<div><span lang="FR"> </span><br class="webkit-block-placeholder">
</div>
<p class="MsoNormal"><span lang="FR">Voice : +32 2 650 32 95 <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR">mail : <a href="mailto:ecaspar@ulb.ac.be">ecaspar@ulb.ac.be</a> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR">office: DB10-138 <o:p></o:p></span></p>
</div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<br>
</div>
</div>
<div><br>
</div>
<br class="Apple-interchange-newline">
</div>
<br>
<div>
<div>Le 28 août 2014 à 09:23, "Caspar, Emilie" <<a href="mailto:e.caspar@ucl.ac.uk">e.caspar@ucl.ac.uk</a>></div>
<div> a écrit :</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
Hi, 
<div><br>
</div>
<div>Thank you for the answer. Indeed, I have no mistake anymore in the script.</div>
<div><br>
</div>
<div>However, my basic problem is still there :  I reject bad trials, but the averaging is on the 100 trials</div>
<div><br>
</div>
<div>Any ideas?</div>
<div><br>
</div>
<div>Emilie</div>
<div>
<div apple-content-edited="true">
<div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<p class="MsoNormal"><br>
</p>
</div>
</div>
</div>
<div>
<div>Le 28 août 2014 à 09:07, Tyler Grummett <<a href="mailto:tyler.grummett@flinders.edu.au">tyler.grummett@flinders.edu.au</a>></div>
<div> a écrit :</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div dir="auto">
<div>Hey Emilie,</div>
<div><br>
</div>
<div>If you remove the inverted commas from 'epData' on line:</div>
<div><br>
</div>
<div>
<blockquote type="cite">
<div style="margin: 0px;"><font color="#e32400">cleandata = ft_rejectartifact(cfg,'epData');</font></div>
</blockquote>
<div><br>
</div>
So that it is:</div>
<div><br>
</div>
<div>
<blockquote type="cite">
<div style="margin: 0px;"><font color="#e32400">cleandata = ft_rejectartifact(cfg,epData);</font></div>
</blockquote>
<div><br>
</div>
does that then work?</div>
<div><br>
</div>
<div>Tyler<br>
<br>
Sent from my iPad</div>
<div><br>
On 28 Aug 2014, at 4:18 pm, "Caspar, Emilie" <<a href="mailto:e.caspar@ucl.ac.uk">e.caspar@ucl.ac.uk</a>> wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>Hello, 
<div><br>
</div>
<div>I'm preprocessing my EEG data. The script works correctly, but I think there is something wrong, when I look at the output.</div>
<div>I reject bad trials with :</div>
<div><br>
</div>
<div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cfg             = [];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cfg.alim        = 100;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cfg.keepchannel = <span style="color: rgb(178, 69, 243); ">'yes'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cfg.layout      = <span style="color: rgb(178, 69, 243); ">'biosemi64.lay'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
% cfg.method      = 'summary';</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
% cfg.method      = 'trial';</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cfg.method      = <span style="color: rgb(178, 69, 243); ">'channel'</span>; <span style="color: rgb(37, 153, 45); ">%% Or 'trial' </span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cfg.metric      = <span style="color: rgb(178, 69, 243); ">'var'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
<span style="">[data_clean]    = ft_rejectvisual(cfg, epData); </span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
<span style="">cfg.artfctdef.reject = </span><span style="color: rgb(178, 69, 243); ">'complete'</span><span style="">; </span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
<span style="">cfg.artfctdef.feedback = </span><span style="color: rgb(178, 69, 243); ">'yes'</span><span style="">; </span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
<span style=""><br>
</span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
<span style=""><br>
</span></div>
<div style="margin: 0px; ">And apparently, Fieldtrip correctly identifies what the trials to reject are, Matlab indicates:</div>
<div style="margin: 0px; ">
<div style="margin: 0px; "><br>
</div>
<div style="margin: 0px; "><font face="Baskerville">91 trials marked as GOOD, 9 trials marked as BAD</font></div>
<div style="margin: 0px; "><font face="Baskerville">66 channels marked as GOOD, 0 channels marked as BAD</font></div>
<div style="margin: 0px; "><font face="Baskerville">the following trials were removed: 13, 23, 32, 42, 58, 59, 61, 95, 99</font></div>
<div style="margin: 0px; "><font face="Baskerville">the call to "ft_rejectvisual" took 27 seconds and required the additional allocation of an estimated NaN MB</font></div>
</div>
<div style="margin: 0px; "><br>
</div>
<div style="margin: 0px; ">So I save this file, before averaging with :</div>
<div style="margin: 0px; ">
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">avgFC = ft_timelockanalysis(cfg, epData);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">ft_singleplotER(cfg,avgFC);</div>
<div><br>
</div>
</div>
<div style="margin: 0px; "><br>
</div>
<div style="margin: 0px; ">What is strange, is that during the averaging, I can see that in my matlab window that the averaging is on 100 trials (= the basic number of trials, without rejection), as if Fieldtrip did not take into account the bad trials in the
 averaging.</div>
<div style="margin: 0px; "><font face="Baskerville"><br>
</font></div>
<div style="margin: 0px; ">
<div style="margin: 0px; "><font face="Baskerville">averaging trials</font></div>
<div style="margin: 0px; "><font face="Baskerville">averaging trial 100 of 100</font></div>
</div>
<div style="margin: 0px; "><br>
</div>
<div style="margin: 0px; "><br>
</div>
<div style="margin: 0px; ">By reading, I though that maybe it was because of this function that was missing into my script :</div>
<div style="margin: 0px; ">
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cleandata = ft_rejectartifact(cfg,<span style="color: rgb(178, 69, 243); ">'epData'</span>);</div>
<div><br>
</div>
<div><br>
</div>
<div>However, I have the following mistake, and I don't understand it:</div>
<div>
<div><font color="#e32400">Error using ft_rejectartifact (line 234)</font></div>
<div><font color="#e32400">no trials were selected, cannot perform artifact detection/rejection</font></div>
<div><font color="#e32400"><br>
</font></div>
<div><font color="#e32400">Error in preprocessing_Libet (line 274)</font></div>
<div><font color="#e32400">cleandata = ft_rejectartifact(cfg,'epData');</font></div>
</div>
<div><br>
</div>
</div>
<div style="margin: 0px; "><br>
</div>
<div style="margin: 0px; "><br>
</div>
<div style="margin: 0px; ">Can someone help?</div>
<div style="margin: 0px; "><br>
</div>
<div style="margin: 0px; "><br>
</div>
<div style="margin: 0px; ">Thank you in advance, </div>
<div style="margin: 0px; "><br>
</div>
<div style="margin: 0px; ">Emilie</div>
</div>
<div apple-content-edited="true">
<div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<p class="MsoNormal"><br>
</p>
</div>
</div>
<div><br>
</div>
<br class="Apple-interchange-newline">
</div>
<br>
</div>
</blockquote>
<blockquote type="cite">
<div><span>_______________________________________________</span><br>
<span>fieldtrip mailing list</span><br>
<span><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a></span><br>
<span><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></span></div>
</blockquote>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></blockquote>
</div>
<br>
</div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></blockquote>
</div>
<br>
</div>
</div>
</blockquote>
<blockquote type="cite">
<div><span>_______________________________________________</span><br>
<span>fieldtrip mailing list</span><br>
<span><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a></span><br>
<span><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></span></div>
</blockquote>
</body>
</html>