<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
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="color: rgb(0, 0, 0); ">[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="color: rgb(0, 0, 0); ">cfg.artfctdef.reject = </span><span style="color: rgb(178, 69, 243); ">'complete'</span><span style="color: rgb(0, 0, 0); ">; </span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
<span style="color: rgb(0, 0, 0); ">cfg.artfctdef.feedback = </span><span style="color: rgb(178, 69, 243); ">'yes'</span><span style="color: rgb(0, 0, 0); ">; </span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
<span style="color: rgb(0, 0, 0); "><br>
</span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
<span style="color: rgb(0, 0, 0); "><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>
</body>
</html>