Station 1 · Lesson 4
ALLEEG & dataset management
eeglab_data.set (D1) · Nothing yet: the data as downloaded.Download the data (opens in a new tab)Script to reach this state
[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');
eeglab redraw;Your browser's back button takes you to the exact place you were, so open anything you like.
The idea in brief
Every processing step creates a new version of your data. EEGLAB can keep several versions in memory at the same time, so you can compare before and after, or go back one step without loading the file again.
EEGLAB uses three variables for this:
Before and after
Your next questions, each answered in its own section:
Why do I need this step?
The reasons in detail, and the terms you need
ALLEEG: the shelf that holds every datasetOne EEG data file loaded in EEGLAB together with its information. in memory.EEG: the dataset you are working on now.CURRENTSET: the number of that dataset on the shelf.
If you do not know which dataset is current, you may filterA tool that weakens some frequencies in a signal and keeps others. the wrong version or save over the original. This lesson shows you how to always know where you are.
Why do I need this step?
ALLEEG: the shelf that holds every dataset in memory.EEG: the dataset you are working on now.CURRENTSET: the number of that dataset on the shelf.
If you do not know which dataset is current, you may filter the wrong version or save over the original. This lesson shows you how to always know where you are.
How do I do it in EEGLAB?
14 steps in the menus
1. Make a change and store it as a new dataset
To have something to store, we make one simple change: remove the two eye channels EOG1 and EOG2. This is only an example for this lesson.
- With
eeglab_data.setopen, open Edit then Select data. - In the Channel(s) row, type
EOG1 EOG2. - Tick the box in the same row, under on->remove these. Without this tick, EEGLAB would keep these two channels and remove all the others.
- Click OK.
- A window opens asking What do you want to do with the new dataset?. In Name it:, replace
Continuous EEG DatawithD1 no EOG. - Leave Save it as file: unticked. The new dataset stays in memory only.
- Leave Overwrite it in memory (set=yes; unset=create a new dataset) unticked, so the original stays as dataset 1.
- Click OK.
The main window now starts with #2: D1 no EOG, and Channels per frame shows 30.
2. Move between datasets
- Open the Datasets . It lists
Dataset 1:Continuous EEG DataandDataset 2:D1 no EOG. The current one has a check mark. - Choose
Dataset 1:Continuous EEG Data. The main window shows#1and 32 channels again. - Any menu you use now works on dataset 1. Before each step, look at the first line of the main window to know which dataset is current.
3. Delete a dataset from memory
- Open Edit then Delete dataset(s) from memory.
- In Dataset(s) to delete:, type
2. - Click OK. The Datasets menu now lists dataset 1 only.
Deleting from memory does not touch any file on disk. A dataset that was never saved is lost when you delete it.
How do I do it in EEGLAB?
1. Make a change and store it as a new dataset
To have something to store, we make one simple change: remove the two eye channels EOG1 and EOG2. This is only an example for this lesson.
- With
eeglab_data.setopen, open Edit then Select data. - In the Channel(s) row, type
EOG1 EOG2. - Tick the box in the same row, under on->remove these. Without this tick, EEGLAB would keep these two channels and remove all the others.
- Click OK.
- A window opens asking What do you want to do with the new dataset?. In Name it:, replace
Continuous EEG DatawithD1 no EOG. - Leave Save it as file: unticked. The new dataset stays in memory only.
- Leave Overwrite it in memory (set=yes; unset=create a new dataset) unticked, so the original stays as dataset 1.
- Click OK.
The main window now starts with #2: D1 no EOG, and Channels per frame shows 30.
2. Move between datasets
- Open the Datasets menu. It lists
Dataset 1:Continuous EEG DataandDataset 2:D1 no EOG. The current one has a check mark. - Choose
Dataset 1:Continuous EEG Data. The main window shows#1and 32 channels again. - Any menu you use now works on dataset 1. Before each step, look at the first line of the main window to know which dataset is current.
3. Delete a dataset from memory
- Open Edit then Delete dataset(s) from memory.
- In Dataset(s) to delete:, type
2. - Click OK. The Datasets menu now lists dataset 1 only.
Deleting from memory does not touch any file on disk. A dataset that was never saved is lost when you delete it.
How do I write it as code?
The same steps in 17 lines of MATLAB
% Start EEGLAB and load the sample dataset as dataset 1
[ALLEEG, EEG, CURRENTSET, ALLCOM] = eeglab;
sampleFolder = fullfile(fileparts(which('eeglab')), 'sample_data');
EEG = pop_loadset('filename', 'eeglab_data.set', 'filepath', sampleFolder);
[ALLEEG, EEG, CURRENTSET] = eeg_store(ALLEEG, EEG, 0);
% Remove the two eye channels and store the result as a new dataset
EEG = pop_select(EEG, 'rmchannel', {'EOG1', 'EOG2'});
[ALLEEG, EEG, CURRENTSET] = pop_newset(ALLEEG, EEG, CURRENTSET, ...
'setname', 'D1 no EOG', 'gui', 'off');
CURRENTSET % 2
[ALLEEG(1).nbchan ALLEEG(2).nbchan] % 32 30
% Go back to dataset 1
[ALLEEG, EEG, CURRENTSET] = pop_newset(ALLEEG, EEG, CURRENTSET, 'retrieve', 1);
EEG.nbchan % 32
% Delete dataset 2 from memory (its file, if any, is not touched)
ALLEEG = pop_delset(ALLEEG, 2);
eeglab redraw;pop_newsetwithCURRENTSETstores the changedEEGas a new dataset after the current one. With'gui', 'off'it does not open the naming window.'retrieve', 1makes dataset 1 the current dataset again, as choosing it from the Datasets menu does.
How do I write it as code?
% Start EEGLAB and load the sample dataset as dataset 1
[ALLEEG, EEG, CURRENTSET, ALLCOM] = eeglab;
sampleFolder = fullfile(fileparts(which('eeglab')), 'sample_data');
EEG = pop_loadset('filename', 'eeglab_data.set', 'filepath', sampleFolder);
[ALLEEG, EEG, CURRENTSET] = eeg_store(ALLEEG, EEG, 0);
% Remove the two eye channels and store the result as a new dataset
EEG = pop_select(EEG, 'rmchannel', {'EOG1', 'EOG2'});
[ALLEEG, EEG, CURRENTSET] = pop_newset(ALLEEG, EEG, CURRENTSET, ...
'setname', 'D1 no EOG', 'gui', 'off');
CURRENTSET % 2
[ALLEEG(1).nbchan ALLEEG(2).nbchan] % 32 30
% Go back to dataset 1
[ALLEEG, EEG, CURRENTSET] = pop_newset(ALLEEG, EEG, CURRENTSET, 'retrieve', 1);
EEG.nbchan % 32
% Delete dataset 2 from memory (its file, if any, is not touched)
ALLEEG = pop_delset(ALLEEG, 2);
eeglab redraw;pop_newsetwithCURRENTSETstores the changedEEGas a new dataset after the current one. With'gui', 'off'it does not open the naming window.'retrieve', 1makes dataset 1 the current dataset again, as choosing it from the Datasets menu does.
Which value should I choose?
Suitable values for your analysis goal
The choice is in the window that opens after each step:
| Option | When to use it |
|---|---|
| Create a new dataset (the default) | You want to compare with the previous version, or you are not sure about the step yet. |
| Overwrite it in memory | Memory is limited, or you no longer need the previous version in this session. |
| Save it as file: | You want to keep this version after closing MATLAB. Give it a new name so you do not overwrite the original file. |
A good habit: give each version a name that says what was done, such as D1 no EOG or D1 filtered 1Hz. A dataset list full of Continuous EEG Data is easy to mix up.
Which value should I choose?
The choice is in the window that opens after each step:
| Option | When to use it |
|---|---|
| Create a new dataset (the default) | You want to compare with the previous version, or you are not sure about the step yet. |
| Overwrite it in memory | Memory is limited, or you no longer need the previous version in this session. |
| Save it as file: | You want to keep this version after closing MATLAB. Give it a new name so you do not overwrite the original file. |
A good habit: give each version a name that says what was done, such as D1 no EOG or D1 filtered 1Hz. A dataset list full of Continuous EEG Data is easy to mix up.
How do I check it worked?
4 quick checks
- After step 1, the first line of the main window is
#2: D1 no EOG, with 30 channels. - The Datasets menu lists two datasets, with a check mark on the current one.
- After switching to dataset 1, the main window shows
#1and 32 channels. - After deleting, the Datasets menu lists dataset 1 only.
Nothing in this lesson is saved to disk, and the sampleA single value of the signal at one point in time. file stays as it was.
How do I check it worked?
- After step 1, the first line of the main window is
#2: D1 no EOG, with 30 channels. - The Datasets menu lists two datasets, with a check mark on the current one.
- After switching to dataset 1, the main window shows
#1and 32 channels. - After deleting, the Datasets menu lists dataset 1 only.
Nothing in this lesson is saved to disk, and the sample file stays as it was.
What mistakes do people make?
4 mistakes and how to avoid them
- Working on the wrong dataset. After you switch from the Datasets menu, every step applies to the dataset you chose. Check the
#number in the first line of the main window before each step. - Thinking that storing in memory saves the file. A new dataset lives in memory until you save it. It is lost when you close MATLAB.
- Forgetting the tick under on->remove these. Without it, Edit then Select data keeps only
EOG1andEOG2, and the new dataset has 2 channels instead of 30. - Changing
EEGin a scriptA MATLAB file of commands that runs processing steps in order. and forgettingeeg_storeorpop_newset. The change is in theEEGvariable only, and the Datasets menu does not know about it.
What mistakes do people make?
- Working on the wrong dataset. After you switch from the Datasets menu, every step applies to the dataset you chose. Check the
#number in the first line of the main window before each step. - Thinking that storing in memory saves the file. A new dataset lives in memory until you save it. It is lost when you close MATLAB.
- Forgetting the tick under on->remove these. Without it, Edit then Select data keeps only
EOG1andEOG2, and the new dataset has 2 channels instead of 30. - Changing
EEGin a script and forgettingeeg_storeorpop_newset. The change is in theEEGvariable only, and the Datasets menu does not know about it.
Your browser doesn't allow saving progress. All lessons are open, but completion marks won't be saved.
Done. Your progress is saved in this browser.UndoWhere can I read more?
1 sources, official docs first
- EEGLAB TutorialDocumentation3. Dataset management
Written for EEGLAB 2026.1 · 2026-10-28
Going further
- EEGLAB Tutorial: https://eeglab.org/tutorials/03_Dataset_management/datasets.html (3. Dataset management)
Need help?
Ask, share feedback, or report an error
- Report a scientific error · Needs a GitHub account. Don't have one? Use "Share your thoughts".