[Eeglablist] epoching for 2 consecutive marker events
ANDREW HILL
andrewhill at ucla.edu
Thu Nov 15 16:41:39 PST 2012
Jess - I suggest you look at event assignment / bin manipulation in ERPLAB - it's extremely straightforward and well documented - very straightforward to do conditional re-assigment of epoch bin/labels, etc.
best,
andrew
On Today 6:34 AM, jhartcher at tuebingen.mpg.de wrote:
> I want to select epochs based on whether marker S 1 is followed by a
> response marker S 4. I have 1000 S 1 markers but i only want to extract
> the 80 S 1 markers followed by S 4 markers, in a time window of [-200
> 500] . If I use the eeg_getepochevent.m function then I have the problem
> that it does not appear to be able to select the particular marker combinations
> that I need.
>
> I have tried to write a separate loop to do this and then use the pop_epoch.m
> function but then I have the problem that the segmented data is not
> part of the EEG struct array anymore.
>
> Is there a function that can do this? I think if I had to select the
> 80 conditional S 1 markers by hand this would not be optimal.
>
> Maybe it is clearer what I want to do if you see my code in which I
> have loaded and filtered my .set data:
>
> %%%%%%%%%%%%%%% Step 1: identify and extract marker times%%%%%%%%%%%%
>
> n_events = length(EEG.event);
>
> % declare empty arrays for storing event latencies
> latency1 = [];
> latency2 = [];
>
> for go = 1:n_events
>
> % find S1/S2 and S4 combinations
> check1 = (strcmp(EEG.event(go).type, 'S 1') && strcmp(EEG.event(go+1).type,
> 'S 4'));
> check2 = (strcmp(EEG.event(go).type, 'S 2') && strcmp(EEG.event(go+1).type,
> 'S 4'));
>
> % store times at which combination S 1 & S 4 occurs
> if check1 == 1
> latency1 = [latency1; EEG.event(go).latency*1/EEG.srate];
> end
>
> % store times at which combination S 2 & S 4 occurs
> if check2 == 1
> latency2 = [latency2; EEG.event(go).latency*1/EEG.srate];
> end
>
> end
>
>
> %%%%%%%%%%%%%%%%%%%%%%%step 2 - not using EEGlab functions but epoching
> according to the Marker combinations%%%%%%%%%%
> % S1
> for go = 1:length(latency1)
>
> % retrieve marker time
> t_marker = latency1(go);
>
> % find indices of time vector
> ind_start = round((t_marker-200/1000)*EEG.srate)
> ind_end = round((t_marker+500/1000)*EEG.srate)
>
>
> % add all data struct
> EEG_S1.epochs(go).data = EEG.data(:, ind_start:ind_end);
> EEG_S1.epochs(go).times = [ind_start:ind_end].'*1/EEG.srate;
>
>
>
> end
>
>
> Thanks in advance.
> jess
>
>
> _______________________________________________
> 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
More information about the eeglablist
mailing list