<div dir="ltr"><div class="gmail_extra">Hej RafaƂ,</div><div class="gmail_extra"><br></div><div class="gmail_extra">I think the most straightforward way would be to find event indices that are followed by events marking correct response. Then you can use these event indices to epoch the data.</div><div class="gmail_extra"><br></div><div class="gmail_extra">If your correct response events are of type '1' (EEG.event.type) as you suggest you can try the following:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">% set the epoching limis:</div><div class="gmail_extra">ep_lim = [-0.2, 0.7];</div><div class="gmail_extra">% look for 'correct' markers:</div></div><div class="gmail_extra">tps = {EEG.event.type};</div><div class="gmail_extra">corr_tp = find(strcmp('1', tps));</div><div class="gmail_extra">% the following step assumes that all correct responses are preceded with events that you want to epoch you data with, this may not necassarily be the case</div><div class="gmail_extra">prev_ev = corr_tp - 1;</div><div class="gmail_extra">% epoch with respect to event just before correct markers:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">EEG = pop_epoch( EEG, {}, ep_lim, 'eventindices', prev_ev);</div></div><div class="gmail_extra"><br></div></div>