[Eeglablist] insert events after some markers in EEG data

Tarik S Bel-Bahar tarikbelbahar at gmail.com
Tue Oct 4 14:07:35 PDT 2016


Yes hello Elisa. Some notes below, best wishes.


**********************************Start Notes for Eliza
For you purposes all you have to do is something similar to the code you
sent, but first try a more simple loop (described right below) that a early
Matlab user can understand. Later you can build more fancy ways to index
matlab variables like the code you sent. So in other words, build your own
baby loop that looks at each event, and makes a new time each time the
event is 2.5.

1. Make a for loop that goes through each of the current events that are in
the file
2. If the current event in the loop matches the ones you are looking for
(13), grab it's time in samples and/or seconds.
3. Now add into a new variable this sample time you grabbed in step 2 plus
2.5 seconds
4. At the end of the loop you should have a variable which contains a list
of times, one time for each place you want one of your new "33" events.
5. Then use the eeg_addnewevents function to simply add a "33" or
"thirtythree" event label at each of the appropriate times. So here, all
the new events are Added all at one time.
***First try running this loop for just a few events and/or one file, and
examine the resulting events in the eeglab file, before running the full
loop on all events/

If you haven't taken the time yet, please be sure to also take a look at
the 10 or 20 other messages on the lists about events as well, and try
those solutions. Just google "eeglablist + events or eeglablist +
adding/editing events". There are several from this year that list several
options and examples. Regardless what option you pick, trust but be sure to
Verify for Yourself.For example, see some examples below.
https://sccn.ucsd.edu/pipermail/eeglablist/2015/009240.html
https://sccn.ucsd.edu/pipermail/eeglablist/2013/007031.html
https://sccn.ucsd.edu/pipermail/eeglablist/2015/009265.html


Things like talking to events do require a little matlab knowledge, but you
can definitely do it if you know how to read function documentation, can
find the correct variable fields in the EEG events structure, and can make
basic matlab loops.

What you probably want to use is eeg_addnewevents function, for which you
can check past eeglablist notes and the documentation for that function
(type help or doc + name of function at command line, you can also google
the function).

If you haven't yet, you should thoroughly look through the eeglab online
tutorial and wiki regarding Event structure, talking to events, getting
events, and Scripting. For example, see the links below. Google the others.

http://sccn.ucsd.edu/wiki/Chapter_03:_Event_Processinghttp://sccn.ucsd.edu/eeglab/eventtut/eventtut_old2.html


If you have not yet, it's best you trying adding events from the GUI first,
with just one event, to understand how to add in one event correctly. Then
use eeg_addnewevents to just add in a whole series of events (33) at all
the specific times you want (see above)

Yes, you might have some problem with the whether the labels are numbers or
words. Just change to one or the other, if one does not work. If you get
clear errors when there should be none, please post the problem to eeglab
bugzilla. Overall, this basic functionality (calling/reading/changing
events in eeglab) should work very easily.

With some testing on your own, you can determine for yourself whether you
need the samples in seconds or in samples. Each function requires it either
in samples or seconds, the documentation and examples specify which. Type
eegh after adding a new event from the gui to also get information about
how to script "adding in new events".

**********************************End Notes for Eliza


















On Sun, Oct 2, 2016 at 9:32 AM, Elisa Tatti <elisatatti at msn.com> wrote:

> Dear EEGLAB users,
>
> We have  EEG recordings with several markers and I would like to add an
> event coded "33" 2.5 seconds after the onset of all the events "13".
> In the EEGLABlist I read about a script to add events on the base of an
> already existent one but it doesn't work on my data (A_latencies is
> empty).  I suppose that this is because my events are coded as numbers and
> the examples provided here were with "characters" (see below):
>
> %Get the latencies (data point indices) for all 'A' type events...
> A_latencies=[EEG.event(find(strcmp('A',{EEG.event.type}))).latency];
>
> %for each A_latencies add a new event type '1' with a latency of (A_latencies(i)+1.5*EEG.srate)-1...
> for i=1:length(A_latencies);
>     n_events=length(EEG.event);
>     EEG.event(n_events+1).type='1';
>     EEG.event(n_events+1).latency=(A_latencies(i)+1.5*EEG.srate)-1;
>     EEG.event(n_events+1).urevent=n_events+1;
> end
>
> %check for consistency and reorder the events chronologically...
> EEG=eeg_checkset(EEG,'eventconsistency');
>
>
>
> I am starting learning matlab now, so I don't know how to adapt this
> script to my data. Can someone help me?!
>
> Thank you for your consideration.
>
>
> Elisa
>
>
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.
> ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20161004/b2059cea/attachment.html>


More information about the eeglablist mailing list