<div dir="ltr"><div><div><div><div>Hi Dana,<br><br></div>I also would have thought these would be implemented, but I couldn't find t hem just now; maybe they're in ERPLAB.<br><br></div>It shouldn't be hard, though, to code this yourself. Below is a quick sample I just made; I can't guarantee this will work in all cases but it gives you an idea. You could easily run some simple code like this and then just add the bad trial list into the EEG.reject structure.<br><br></div>Best,<br></div>Steve<br><div><div><br><br>%%% MAXMIN CRITERION<br><br>% Finds the difference between the maximum and minimum of each epoch. Could<br>% be tweaked to look only at a certain time range within the epoch<br>diffs = squeeze( max(EEG.data,[],2) - min(EEG.data,[],2) );<br><br>% We'll kick out any trials whose difference exceeds this uV threshhold<br>threshold = 200;<br><br>% Find samples that exceed the threshhold<br>[chanidx, epochidx] = find( diffs > threshold );<br><br>% Find epochs that have at least one sample, at any channel, exceeding the<br>% threshhold<br>badepochs.maxmin = unique( epochidx );<br><br><br><br><br><br><br><br><br><br>%%% NEIGHBORING SAMPLES CRITERION<br><br>% Find the difference between neighboring samples each pair of neighboring samples<br>diffs = arrayfun( @(x)( squeeze (EEG.data(:,x,:) - EEG.data(:,x-1,:) ) ), 2:size(EEG.data,2), 'UniformOutput', false );<br><br></div><div>% organize that cell array into a matrix, which will be easier to work with<br></div><div>n_chan = size(diffs{1},1);<br>n_samp = length(diffs);<br>n_trial = size(diffs{1},2);<br>diffs = reshape(cell2mat(diffs), n_chan, n_samp, n_trial);<br><br>% get the max difference across samples, for each trial<br>diffs = squeeze( max(diffs,[],2) );<br><br>% We'll kick out any trials whose difference exceeds this uV threshhold<br>threshold = 75;<br><br>% Find samples that exceed the threshhold<br>[chanidx, epochidx] = find( diffs > threshold );<br><br>% Find epochs that have at least one sample, at any channel, exceeding the<br>% threshhold<br>badepochs.neighbsamp = unique( epochidx );<br></div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><br><br></div>Stephen Politzer-Ahles<br>New York University, Abu Dhabi<br>Neuroscience of Language Lab<br><a href="http://www.nyu.edu/projects/politzer-ahles/" target="_blank">http://www.nyu.edu/projects/politzer-ahles/</a><br></div></div></div>
<br><div class="gmail_quote">On Thu, Apr 30, 2015 at 12:37 PM, Son, D.M.E. van <span dir="ltr"><<a href="mailto:d.m.e.van.son@fsw.leidenuniv.nl" target="_blank">d.m.e.van.son@fsw.leidenuniv.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">






<div>
<font face="Calibri" size="2"><span style="font-size:11pt">
<div>Dear Eeglab members, <br>

<br>

Before manually selecting artifacts in my data, I would like to pre-select artifacts automatically. I have seen that Eeglab provides an automatic epoch rejection toolbox, but specific epoch selection that I would like to make, does not seem to be provided.
<br>

e.g.; I would like to remove epochs where the difference between the maximum and minimum in an interval of a selectable length, and the difference between the maximum and minimum in the epoch itself, exceeds a specific value. Also, I’d like to remove epochs
wherin the absolute difference between two neighboring sampling points exceeds a certain value.  
<br>

<br>

Does anyone have an idea if this is possible in Eeglab automatically? Or perhaps it is possible that I script this separately?
<br>

<br>

Many thanks in advance<br>

<br>

Dana </div>
<div> </div>
</span></font>
</div>

<br>_______________________________________________<br>
Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" target="_blank">http://sccn.ucsd.edu/eeglab/eeglabmail.html</a><br>
To unsubscribe, send an empty email to <a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu">eeglablist-unsubscribe@sccn.ucsd.edu</a><br>
For digest mode, send an email with the subject "set digest mime" to <a href="mailto:eeglablist-request@sccn.ucsd.edu">eeglablist-request@sccn.ucsd.edu</a><br></blockquote></div><br></div>