[Eeglablist] How can split a continuous register in epoched data

Raquel London raquel at dragondelapatagonia.com
Thu Jul 2 03:14:08 PDT 2015


Hi Mateu,

I had the same issue and solved it with the following script. Don't know if
its the most elegant solution, but it worked for me.

In order to epoch the data, you need to have markers. If you don't have a
marker every two seconds, you need to create them. I had data without
markers every 2 seconds, but I had a marker indicating the start of the
experiment and also there were a few "junk" markers in the data I needed to
gt rid of.

The "2" marker indicated the start of the experiment, so I needed to keep
it. I also needed to erase all other markers, and create new markers; one
every 2 seconds. So first, I made sure to save the specifications of this
first "2" marker, then I erased all markers and recreated the first "2"
marker based on those specs. Then I inserted new markers ("10") every 2
seconds (1024 samples at 512 Hz), and epoched the data based on them.

I hope it works for you.

Cheers,
Raquel

%extract specs of all "2" markers, we only need the first one
k = 0;
for i = 1:length(EEG.event);
    if EEG.event(1,i).type == 2;
        k = k+1;
        lat(1,k) = EEG.event(1,i).latency;
    end
end

%erase events and recreate the first "2" marker
EEG.event = 0;
EEG.event.type = 2;
EEG.event.latency = lat(1,1);
EEG.event.urevent = 2;

%create 1 300 sec epoch starting at the marker
EEG = pop_epoch( EEG, {  '2'  }, [0  300], 'newname', 'BDF file epochs',
'epochinfo', 'yes');
EEG = eeg_checkset( EEG );

%create a "10" marker at the start and every consecutive 2 sec of data,
%resulting in 150 markers
%with a 512 Hz sample rate, 2 sec = 1024 samples

for i = 1:150;
    EEG.event(1,i).type = 10;
    EEG.event(1,i).latency = i*1024-1024+1;
    EEG.event(1,i).urevent = 10;
end

%create 150 2 sec epochs
EEG = pop_epoch( EEG, {  '10'  }, [0  2], 'newname', 'BDF file epochs',
'epochinfo', 'yes');
EEG = eeg_checkset( EEG );

--
Dragón de la Patagonia
Ramon Barros Luco 688
Puerto Natales - Patagonia - Chile
Oficina: +56-9-94022038
Skype: raquel.london


On Tue, Jun 30, 2015 at 10:42 AM, Mateu Servera <mservera at gmail.com> wrote:

> Hi,
>
> My problem seems simple but (I'm sorry) have not found the solution in the
> tutorial. I have a continuous record of 2 minutes and I want to analyze by
> epochs of 2 seconds. That is, once I loaded the entire record I want to
> divide approximately in 180/2 = 90 epochs, and then analyze data by epochs
> to select or eliminate those with artifacts.
>
> I have found how to deal with epoched data previously defined during the
> recording, but not *a posteriori*.
>
> Thanks
>
> Mateu
>
> _______________________________________________
> 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/20150702/5230a399/attachment.html>


More information about the eeglablist mailing list