<div dir="ltr">Hello Min, just a quick followup that may be able to help, in addition to the examples from James and Arno.<br>below shows an example of searching for one event and renaming or inserting new events,<br>again using eeg_addnewevents function in eeglab. You can try pasting the below into matlab. Good luck!<br>

<br><br>%the following micro-codelet loops through the events of a loaded<div style="color:rgb(51,51,153);display:inline" class="gmail_default"> </div>continuous eeglab file<br>%event list. It looks for particular labels, and creates a list<br>

% of times that can be fed to the eeg_addnewevents function<br>% to create a new set of events at those times<br>%if same time as the old event is used, then the old event is overwritten<br>%(but those events may still reside in the urevents eeglab structure)<br>

%%if a unique time stamp is used (e.g., current time + .239)<div>%then the current event will not be overwritten</div><div><br></div><div><br> timeStamps=[];<br><br>for jester = 1: length(EEG.event)-1<br>    thetype = EEG.event(1,jester).type<br>

    if strcmp(thetype, 'THEEVENTYOUARELOOKINGFOR') ==1<br>        currlat = EEG.event(1,jester).latency ;    %gets the currents<div style="color:rgb(51,51,153);display:inline" class="gmail_default"> </div>time in samples (also called frames)<br>

        timeStamps(end+1) = currlat; % add the current time in samples to a list of times<br>    end;end;<br><br>EEG = eeg_addnewevents(EEG, {[timeStamps] }, {'NEWEVENTLABEL'});<br><div style="color:rgb(51,51,153);display:inline" class="gmail_default">

</div></div><div><div style="color:rgb(51,51,153);display:inline" class="gmail_default"></div>%the times to be fed to the eeg_addnewevents function needs to be number of<br>%samples -also called frames in the eeglab gui<br>

<br></div><div>eeglab redraw<br><br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</div></div><div class="gmail_extra"><br clear="all"><div>Tarik Bel-Bahar, Postdoctoral Fellow<br>Perception, Performance & Psychophysiology Lab<br>

<a href="http://tarik.777@duke.edu/" target="_blank">tarik.777@duke.edu/</a> 919 328 9573<br>Div. of Brain Stimulation and Neurophysiology<br>Dep. of Psychiatry and Behavioral Sciences<br>Duke University Medical Center, Duke Clinics<br>

Red Zone, 5th Floor, Rm. 54236<br>200 Trent Drive, Durham, NC 27710</div>
<br><br><div class="gmail_quote">On Fri, Sep 6, 2013 at 12:02 AM, Tarik S Bel-Bahar <span dir="ltr"><<a href="mailto:tarikbelbahar@gmail.com" target="_blank">tarikbelbahar@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hello Min, just a quick followup that may be able to help, in addition to<br>
the examples from James and Arno.<br>
below shows an example of searching for one event and renaming or<br>
inserting new events,<br>
again using eeg_addnewevents function in eeglab. You can try pasting<br>
the below into matlab. Good luck!<br>
<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
<br>
<br>
%the following micro-codelet loops through the events of a loaded<br>
continuous eeglab file<br>
%event list. It looks for particular labels, and creates a list<br>
% of times that can be fed to the eeg_addnewevents function<br>
% to create a new set of events at those times<br>
%if same time as the old event is used, then the old event is overwritten<br>
%(but those events may still reside in the urevents eeglab structure)<br>
%%if a unique time is used (such as o<br>
<br>
 timeStamps=[];<br>
<br>
for jester = 1: length(EEG.event)-1<br>
    thetype = EEG.event(1,jester).type<br>
    if strcmp(thetype, 'THEEVENTYOUARELOOKINGFOR') ==1<br>
        currlat = EEG.event(1,jester).latency ;    %gets the currents<br>
time in samples (also called frames)<br>
        timeStamps(end+1) = currlat; % add the current time in samples<br>
to a list of times<br>
    end;end;<br>
<br>
EEG = eeg_addnewevents(EEG, {[timeStamps] }, {'?NEWEVENTLABEL'});<br>
%the times to be fed to the eeg_addnewevents function needs to be number of<br>
%samples -also called frames in the eeglab gui<br>
eeglab redraw<br>
<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
</blockquote></div><br></div>