Simply EEGLAB
Merging & selecting data
Station 1 · Lesson 6 · EEGLAB 2026.1
In the GUI
- EditSelect data
eeglab_data.set - Time range [min max] (s)on->remove these
0 120 - OKWhat do you want to do with the new dataset?Name it:OK
D1 part 1 - Frames per epoch
#2: D1 part 1 - Datasets
Dataset 1:Continuous EEG Data - EditSelect data
- Time range [min max] (s)on->remove these
0 120 - OK
D1 part 2 - EditAppend datasets
- Dataset indices to merge
2 3 - Preserve ICA weights of the first dataset ?OK
- OK
Merged datasetsD1 merged - Events
#4: D1 merged - PlotChannel data (scroll)
D1 merged - Datasets
Dataset 1:Continuous EEG Data - EditSelect data using eventsRemove data portions around events - pop_rmdat()
- Event type(s) ([]=all)
square - Time limits [start, end] in sec.
-0.5 1square - Keep selectedOK
D1 around square - Events
boundary
Script
[ALLEEG, EEG, CURRENTSET, ALLCOM] = eeglab;
sampleFolder = fullfile(fileparts(which('eeglab')), 'sample_data');
EEG = pop_loadset('filename', 'eeglab_data.set', 'filepath', sampleFolder);
[ALLEEG, EEG, CURRENTSET] = pop_newset(ALLEEG, EEG, 0, ...
'setname', 'Continuous EEG Data', 'gui', 'off');
EEG = pop_select(ALLEEG(1), 'time', [0 120]);
[ALLEEG, EEG, CURRENTSET] = pop_newset(ALLEEG, EEG, CURRENTSET, ...
'setname', 'D1 part 1', 'gui', 'off');
EEG = pop_select(ALLEEG(1), 'rmtime', [0 120]);
[ALLEEG, EEG, CURRENTSET] = pop_newset(ALLEEG, EEG, CURRENTSET, ...
'setname', 'D1 part 2', 'gui', 'off');
EEG = pop_mergeset(ALLEEG, [2 3], 0);
[ALLEEG, EEG, CURRENTSET] = pop_newset(ALLEEG, EEG, CURRENTSET, ...
'setname', 'D1 merged', 'gui', 'off');
[ALLEEG.pnts] % 30504 15361 15143 30504
isequal(ALLEEG(4).data, ALLEEG(1).data) % 1: same signal as the original
eeg_eventtypes(EEG) % square 80, rt 74, boundary 1
EEG.event(eeg_findboundaries(EEG)).latency % 15361.5: between samples 15361 and 15362
EEG = pop_rmdat(ALLEEG(1), {'square'}, [-0.5 1], 0);
[ALLEEG, EEG, CURRENTSET] = pop_newset(ALLEEG, EEG, CURRENTSET, ...
'setname', 'D1 around square', 'gui', 'off');
EEG.pnts % 15336
numel(eeg_findboundaries(EEG)) % 80
eeglab redraw;Which value should I choose?
| What you want | Menu | What to type |
|---|---|---|
| One continuous part of the recording | Edit > Select data | The range in seconds in Time range [min max] (s), checkbox unticked. |
| Remove one continuous part (start, end or a break) | Edit > Select data | The same range, with the checkbox under on->remove these ticked. |
| The data around one event type | Edit > Select data using events | The event type, the limits in seconds around it, and Keep selected. |
| Remove the data around an event, such as a TMS pulse that saturates the amplifier | Edit > Select data using events | The event type, short limits around it, and Remove selected. The official tutorial gives this example. |
| Several runs of one participant in one dataset | Edit > Append datasets | The dataset numbers in the order they were recorded. |
Check
- The Datasets menu lists five datasets:
Continuous EEG Data,D1 part 1,D1 part 2,D1 mergedandD1 around square - Frames per epoch for the first four: 30504, 15361, 15143 and 30504
D1 mergedhas 155 events,eeg_eventtypesshowsboundary 1, and you see it as a red line at 120 seconds in the scroll windowisequal(ALLEEG(4).data, ALLEEG(1).data)gives1: merging gave back exactly the original signalD1 around squarehas 15336 samples and 80boundaryevents
For your Methods
Data from the [N] recording runs were concatenated into a single continuous dataset (pop_mergeset, EEGLAB 2026.1), with boundary events marking the joins.