[Eeglablist] how to create new data sets based on the number of event

Tarik S Bel-Bahar tarikbelbahar at gmail.com
Fri Sep 6 09:08:29 PDT 2013


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


%the following micro-codelet loops through the events of a loaded
continuous eeglab file
%event list. It looks for particular labels, and creates a list
% of times that can be fed to the eeg_addnewevents function
% to create a new set of events at those times
%if same time as the old event is used, then the old event is overwritten
%(but those events may still reside in the urevents eeglab structure)
%%if a unique time stamp is used (e.g., current time + .239)
%then the current event will not be overwritten


 timeStamps=[];

for jester = 1: length(EEG.event)-1
    thetype = EEG.event(1,jester).type
    if strcmp(thetype, 'THEEVENTYOUARELOOKINGFOR') ==1
        currlat = EEG.event(1,jester).latency ;    %gets the currents
time in samples (also called frames)
        timeStamps(end+1) = currlat; % add the current time in samples to a
list of times
    end;end;

EEG = eeg_addnewevents(EEG, {[timeStamps] }, {'NEWEVENTLABEL'});
%the times to be fed to the eeg_addnewevents function needs to be number of
%samples -also called frames in the eeglab gui

eeglab redraw

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Tarik Bel-Bahar, Postdoctoral Fellow
Perception, Performance & Psychophysiology Lab
tarik.777 at duke.edu/ 919 328 9573
Div. of Brain Stimulation and Neurophysiology
Dep. of Psychiatry and Behavioral Sciences
Duke University Medical Center, Duke Clinics
Red Zone, 5th Floor, Rm. 54236
200 Trent Drive, Durham, NC 27710


On Fri, Sep 6, 2013 at 12:02 AM, Tarik S Bel-Bahar
<tarikbelbahar at gmail.com>wrote:

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


More information about the eeglablist mailing list