Events Segmentation in EEGLAB

11 views (last 30 days)
Khan Muhammad Adeel Khan
Khan Muhammad Adeel Khan on 12 Apr 2021
Edited: Prasanna on 23 Apr 2024 at 8:13
Hello ! I am having an EEG data from more than 100 participants and it consist of 120 events. How can I segment the events into half as I am using eeglab script to process the data ? I want to analyze the first half and second half separately. Thanking you in anticipation.

Answers (1)

Prasanna
Prasanna on 23 Apr 2024 at 8:12
Edited: Prasanna on 23 Apr 2024 at 8:13
Hi,
To segment and analyse the first and second halves of EEG events separately for each participant using EEGLAB, you can identify the events you want to segment around, create epochs for these events, and then divide the dataset based on these epochs. Given that you have 120 events per participant, and you wish to split these into two halves, here's a sample code for the same:
participants = dir('/path/to/your/data/*.set'); % Adjust the path and extension if necessary
for i = 1:length(participants)
filename = participants(i).name;
EEG = pop_loadset('filename', filename, 'filepath', '/path/to/your/data/');
% Segment into first half
EEG_firstHalf = pop_selectevent( EEG, 'event', [1:60], 'deleteevents', 'off', 'deleteepochs', 'on', 'invertepochs', 'off');
% Segment into second half
EEG_secondHalf = pop_selectevent( EEG, 'event', [61:120], 'deleteevents', 'off', 'deleteepochs', 'on', 'invertepochs', 'off');
% Analysis code for each half goes here
end
For more details on the pop_selectevent function you can look at the documentation provided here: https://sccn.ucsd.edu/~arno/eeglab/auto/pop_selectevent.html
Hope this helps.

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!