Station 8 · Lesson 1
What a STUDY is and when you need one
animal.study (D6) · Nothing yet: the data as downloaded.Download the data (opens in a new tab)Script to reach this state
[ALLEEG, EEG, CURRENTSET, ALLCOM] = eeglab;
% Folder for the course data (change it)
dataFolder = 'C:\Users\me\Documents\eeg-course';
% Download the ready Go-nogo STUDY once and unzip it in its own folder
zipDir = fullfile(dataFolder, 'animal_study');
studyFile = dir(fullfile(zipDir, '**', 'animal.study'));
if isempty(studyFile)
zipFile = fullfile(dataFolder, 'animal_study.zip');
websave(zipFile, 'https://sccn.ucsd.edu/eeglab/download/animal_study.zip');
unzip(zipFile, zipDir);
studyFile = dir(fullfile(zipDir, '**', 'animal.study'));
end
studyDir = studyFile(1).folder;
fprintf('Go-nogo STUDY folder: %s\n', studyDir);
eeglab redraw;Your browser's back button takes you to the exact place you were, so open anything you like.
The idea in brief
So far you have worked on one recording from one participantThe person whose data were recorded in the study.. A research question, though, is usually about a group: does the ERPThe brain's average response to a given event across many trials. differ between two kinds of image in most participants, not just in one person?
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
In EEGLAB, a STUDYAn EEGLAB structure that groups many participants' datasets for joint analysis. is an index file for that question. It stores the list of participant files, and for each file the subject, conditionAn experimental situation compared with others, such as familiar vs unfamiliar., group and session. It also stores designs and precomputed measures. It does not merge the data, and it does not process it again.
So a STUDY trusts that your files match in everything that matters. If the sampling rateThe number of samples recorded per second on each channel., the epochA short time segment cut out around an event. window or the eventA marker in the recording that flags a moment of interest, such as a stimulus. names differ between participants, functions crash or silently give wrong results. This lesson teaches you to check before you create one.
Why do I need this step?
In EEGLAB, a STUDY is an index file for that question. It stores the list of participant files, and for each file the subject, condition, group and session. It also stores designs and precomputed measures. It does not merge the data, and it does not process it again.
So a STUDY trusts that your files match in everything that matters. If the sampling rate, the epoch window or the event names differ between participants, functions crash or silently give wrong results. This lesson teaches you to check before you create one.
How do I do it in EEGLAB?
8 steps in the menus
About the data (D6): a Go-nogo experiment with 14 participants (Delorme et al.). A picture is flashed for 20 ms, and the participant lifts a finger off a button as fast as possible if it contains an animal, and keeps it down if not. The EEGLAB copy, ready as a STUDY, is already processed and epoched, with one file per participant for animal pictures (animal) and one for the other pictures (distractor). The raw data are on OpenNeuro in BIDSA standard for naming and organizing neuroimaging data files. format, and we use them in the lesson on creating a STUDY from BIDS.
Why not continue with D1? Because D1 is one participant’s recording, and a STUDY needs several participants.
1. Download the data and open the folder
- Run the “Starting point” scriptA MATLAB file of commands that runs processing steps in order.. It downloads
animal_study.zipfrom the EEGLAB data page, unzips it once, and prints the folder location. - Open the folder in your file browser. It holds the ready file
animal.studyand one folder per participant named by its code, fromcbatowpa. Each folder holds two datasets, such assphanimal.setandsphdistractor.set. The data of each datasetOne EEG data file loaded in EEGLAB together with its information. are in a.datfile next to it (the older EEGLAB format; onlycbakeeps its data inside the.set). You will also see files such assphanimal.daterpandsphanimal.icaerp: measures precomputed with EEGLAB 6 in 2007. We do not use them, and the precomputeComputing and saving ERPs or spectra for each participant and condition before STUDY plotting and statistics. lesson explains why. - Do not open
animal.studyyet. We check the files before any STUDY.
2. Check one participant’s file
- Open File then Load existing dataset and choose
animal_study/cba/cbaanimal.set, the animal-condition file of the first participant. - Read the main window and note these values on paper: Channels per frame, Frames per epoch, Epochs, Sampling rate (Hz), Epoch start (sec), Epoch end (sec), Reference, Channel locations, ICA weights.
3. Check another participant’s file and compare
- Open
animal_study/wpa/wpaanimal.set, the animal-condition file of the last participant, the same way. - Compare the values with your notes. All of them must match except Epochs, because the number of trials left after rejectionExcluding epochs or data that are unfit for analysis. naturally differs between people. In this copy you should read 32 channels, 750 frames per epoch, 250 Hz, and an epoch from -1 to 1.996 sec.
- The script below compares the same two files, on the same values, plus channel names, event types, ICLabel results and dipoles, which the main window does not show.
4. STUDY or ALLEEG?
| ALLEEG | STUDY | |
|---|---|---|
| What it is | The list of datasets open in memory right now | A .study file that describes a set of files and how they relate |
| Knows subject and condition | No, only what you wrote in each dataset | Yes, for every file |
| Stores designs and precomputed measures | No | Yes |
| Survives closing EEGLAB | No | Yes, and opening it fills ALLEEG again |
| When to use it | A quick comparison of two or three files from one participant | Any analysis of a group of participants |
Memory with many participants
With dozens of participants, memory cannot hold every file. In File then Preferences, turn on If set, keep at most one dataset in memory. This allows processing hundreds of datasets within studies., and EEGLAB reads files from disk when needed. With the 14 participants here you usually do not need it. When you create or open a STUDY, a Study warning window suggests this option, and the next lesson, on creating a STUDY, explains what to press.
Memory with many participants
With dozens of participants, memory cannot hold every file. In File then Preferences, turn on If set, keep at most one dataset in memory. This allows processing hundreds of datasets within studies., and EEGLAB reads files from disk when needed. With the 14 participants here you usually do not need it. When you create or open a STUDY, a Study warning window suggests this option, and the next lesson, on creating a STUDY, explains what to press.
How do I do it in EEGLAB?
About the data (D6): a Go-nogo experiment with 14 participants (Delorme et al.). A picture is flashed for 20 ms, and the participant lifts a finger off a button as fast as possible if it contains an animal, and keeps it down if not. The EEGLAB copy, ready as a STUDY, is already processed and epoched, with one file per participant for animal pictures (animal) and one for the other pictures (distractor). The raw data are on OpenNeuro in BIDS format, and we use them in the lesson on creating a STUDY from BIDS.
Why not continue with D1? Because D1 is one participant’s recording, and a STUDY needs several participants.
1. Download the data and open the folder
- Run the “Starting point” script. It downloads
animal_study.zipfrom the EEGLAB data page, unzips it once, and prints the folder location. - Open the folder in your file browser. It holds the ready file
animal.studyand one folder per participant named by its code, fromcbatowpa. Each folder holds two datasets, such assphanimal.setandsphdistractor.set. The data of each dataset are in a.datfile next to it (the older EEGLAB format; onlycbakeeps its data inside the.set). You will also see files such assphanimal.daterpandsphanimal.icaerp: measures precomputed with EEGLAB 6 in 2007. We do not use them, and the precompute lesson explains why. - Do not open
animal.studyyet. We check the files before any STUDY.
2. Check one participant’s file
- Open File then Load existing dataset and choose
animal_study/cba/cbaanimal.set, the animal-condition file of the first participant. - Read the main window and note these values on paper: Channels per frame, Frames per epoch, Epochs, Sampling rate (Hz), Epoch start (sec), Epoch end (sec), Reference, Channel locations, ICA weights.
3. Check another participant’s file and compare
- Open
animal_study/wpa/wpaanimal.set, the animal-condition file of the last participant, the same way. - Compare the values with your notes. All of them must match except Epochs, because the number of trials left after rejection naturally differs between people. In this copy you should read 32 channels, 750 frames per epoch, 250 Hz, and an epoch from -1 to 1.996 sec.
- The script below compares the same two files, on the same values, plus channel names, event types, ICLabel results and dipoles, which the main window does not show.
4. STUDY or ALLEEG?
| ALLEEG | STUDY | |
|---|---|---|
| What it is | The list of datasets open in memory right now | A .study file that describes a set of files and how they relate |
| Knows subject and condition | No, only what you wrote in each dataset | Yes, for every file |
| Stores designs and precomputed measures | No | Yes |
| Survives closing EEGLAB | No | Yes, and opening it fills ALLEEG again |
| When to use it | A quick comparison of two or three files from one participant | Any analysis of a group of participants |
Memory with many participants
With dozens of participants, memory cannot hold every file. In File then Preferences, turn on If set, keep at most one dataset in memory. This allows processing hundreds of datasets within studies., and EEGLAB reads files from disk when needed. With the 14 participants here you usually do not need it. When you create or open a STUDY, a Study warning window suggests this option, and the next lesson, on creating a STUDY, explains what to press.
Memory with many participants
With dozens of participants, memory cannot hold every file. In File then Preferences, turn on If set, keep at most one dataset in memory. This allows processing hundreds of datasets within studies., and EEGLAB reads files from disk when needed. With the 14 participants here you usually do not need it. When you create or open a STUDY, a Study warning window suggests this option, and the next lesson, on creating a STUDY, explains what to press.
How do I write it as code?
The same steps in 25 lines of MATLAB
% studyDir comes from the starting point script
files = dir(fullfile(studyDir, '*', '*.set'));
fprintf('%d dataset files under %s\n', numel(files), studyDir);
% Header only (no data) of the animal file of the first and the last participant
animalFiles = files(contains({files.name}, 'animal'));
A = pop_loadset('filename', animalFiles(1).name, 'filepath', animalFiles(1).folder, 'loadmode', 'info');
B = pop_loadset('filename', animalFiles(end).name, 'filepath', animalFiles(end).folder, 'loadmode', 'info');
% Side-by-side check of what must match before a STUDY
show = @(label, a, b) fprintf('%-20s %-14s %-14s\n', label, num2str(a), num2str(b));
fprintf('%-20s %-14s %-14s\n', 'Property', animalFiles(1).name, animalFiles(end).name);
show('Sampling rate (Hz)', A.srate, B.srate);
show('Channels', A.nbchan, B.nbchan);
show('Points per epoch', A.pnts, B.pnts);
show('Epoch start (s)', A.xmin, B.xmin);
show('Epoch end (s)', A.xmax, B.xmax);
show('Epochs', A.trials, B.trials);
show('ICA weights', ~isempty(A.icaweights), ~isempty(B.icaweights));
show('ICA components', size(A.icaweights, 1), size(B.icaweights, 1));
show('ICLabel results', isfield(A.etc, 'ic_classification'), isfield(B.etc, 'ic_classification'));
show('Dipoles', isfield(A.dipfit, 'model'), isfield(B.dipfit, 'model'));
fprintf('Same channel labels in the same order: %d\n', ...
isequal({A.chanlocs.labels}, {B.chanlocs.labels}));
% Event types and their counts in each file
eeg_eventtypes(A);
eeg_eventtypes(B);How do I write it as code?
% studyDir comes from the starting point script
files = dir(fullfile(studyDir, '*', '*.set'));
fprintf('%d dataset files under %s\n', numel(files), studyDir);
% Header only (no data) of the animal file of the first and the last participant
animalFiles = files(contains({files.name}, 'animal'));
A = pop_loadset('filename', animalFiles(1).name, 'filepath', animalFiles(1).folder, 'loadmode', 'info');
B = pop_loadset('filename', animalFiles(end).name, 'filepath', animalFiles(end).folder, 'loadmode', 'info');
% Side-by-side check of what must match before a STUDY
show = @(label, a, b) fprintf('%-20s %-14s %-14s\n', label, num2str(a), num2str(b));
fprintf('%-20s %-14s %-14s\n', 'Property', animalFiles(1).name, animalFiles(end).name);
show('Sampling rate (Hz)', A.srate, B.srate);
show('Channels', A.nbchan, B.nbchan);
show('Points per epoch', A.pnts, B.pnts);
show('Epoch start (s)', A.xmin, B.xmin);
show('Epoch end (s)', A.xmax, B.xmax);
show('Epochs', A.trials, B.trials);
show('ICA weights', ~isempty(A.icaweights), ~isempty(B.icaweights));
show('ICA components', size(A.icaweights, 1), size(B.icaweights, 1));
show('ICLabel results', isfield(A.etc, 'ic_classification'), isfield(B.etc, 'ic_classification'));
show('Dipoles', isfield(A.dipfit, 'model'), isfield(B.dipfit, 'model'));
fprintf('Same channel labels in the same order: %d\n', ...
isequal({A.chanlocs.labels}, {B.chanlocs.labels}));
% Event types and their counts in each file
eeg_eventtypes(A);
eeg_eventtypes(B);Which value should I choose?
Suitable values for your analysis goal
This is the checklist before any STUDY. “Must” means functions crash or go wrong if it differs.
| What to check | Rule | Why |
|---|---|---|
| Sampling rate | Must match | EEGLAB prints a warning over several lines on creation, starting with IMPORTANT WARNING: SOME DATASETS DO NOT HAVE THE SAME SAMPLING, and most STUDY functions then crash. |
| Epoch window and number of points | Must match | Precomputing compares time point with time point across participants. |
| Channel names | Must use the same naming system | A STUDY matches channels by name (ignoring upper and lower case). T7 in one file and T3 (the old name for the same site) in another are two different channels to it. |
| Removed channels | Best interpolated in each participant’s file before the STUDY | Precomputing has an interpolation option, but interpolating in the file itself is clearer and you can check it by eye. |
| Event and condition names | Must be spelled the same | Each different spelling becomes a new condition. |
| Processing steps (filters, reference, rejection) | Must be the same | A STUDY never checks them. This is why the shared processing script comes in station 9. |
| ICA weights and ICLabel results | Needed to remove flagged components during precomputing | Without them there is nothing to remove. |
| Dipoles | Needed to cluster components by location | They are the basis of the IC clustering lesson. |
| Number of epochs | Naturally differs | But a participant with very few epochs left has a weak average. Note the count for each participant. |
Which value should I choose?
This is the checklist before any STUDY. “Must” means functions crash or go wrong if it differs.
| What to check | Rule | Why |
|---|---|---|
| Sampling rate | Must match | EEGLAB prints a warning over several lines on creation, starting with IMPORTANT WARNING: SOME DATASETS DO NOT HAVE THE SAME SAMPLING, and most STUDY functions then crash. |
| Epoch window and number of points | Must match | Precomputing compares time point with time point across participants. |
| Channel names | Must use the same naming system | A STUDY matches channels by name (ignoring upper and lower case). T7 in one file and T3 (the old name for the same site) in another are two different channels to it. |
| Removed channels | Best interpolated in each participant’s file before the STUDY | Precomputing has an interpolation option, but interpolating in the file itself is clearer and you can check it by eye. |
| Event and condition names | Must be spelled the same | Each different spelling becomes a new condition. |
| Processing steps (filters, reference, rejection) | Must be the same | A STUDY never checks them. This is why the shared processing script comes in station 9. |
| ICA weights and ICLabel results | Needed to remove flagged components during precomputing | Without them there is nothing to remove. |
| Dipoles | Needed to cluster components by location | They are the basis of the IC clustering lesson. |
| Number of epochs | Naturally differs | But a participant with very few epochs left has a weak average. Note the count for each participant. |
How do I check it worked?
4 quick checks
- The script prints the number of files in the folder, 28 if each of the 14 participants has two files.
- Every line matches between the two files except
EpochsandICA components, and the channel-name line prints 1.cbahas 29 components andwpa31: the number of components can differ between participants, and clustering does not need it to match. eeg_eventtypesprints the same event types for both animal files,Animalandrt, even if the counts differ. A distractor file hasDistractoronly, because there is no response on no-go trials.- You know the answer to: do the files have ICA weights and dipoles? Here the authors’ ICA weights and dipoles are present (
1on both lines) and ICLabel results are not (0). The clustering lesson keeps the ICA and the dipoles, and runs ICLabel.
About the data
Data: STUDY version: SCCN/Delorme. Original data: OpenNeuro ds002680 (CC0).
About the data
Data: STUDY version: SCCN/Delorme. Original data: OpenNeuro ds002680 (CC0).
How do I check it worked?
- The script prints the number of files in the folder, 28 if each of the 14 participants has two files.
- Every line matches between the two files except
EpochsandICA components, and the channel-name line prints 1.cbahas 29 components andwpa31: the number of components can differ between participants, and clustering does not need it to match. eeg_eventtypesprints the same event types for both animal files,Animalandrt, even if the counts differ. A distractor file hasDistractoronly, because there is no response on no-go trials.- You know the answer to: do the files have ICA weights and dipoles? Here the authors’ ICA weights and dipoles are present (
1on both lines) and ICLabel results are not (0). The clustering lesson keeps the ICA and the dipoles, and runs ICLabel.
About the data
Data: STUDY version: SCCN/Delorme. Original data: OpenNeuro ds002680 (CC0).
About the data
Data: STUDY version: SCCN/Delorme. Original data: OpenNeuro ds002680 (CC0).
What mistakes do people make?
5 mistakes and how to avoid them
- Creating the STUDY before checking. A STUDY is created without error even if the files differ, and the problem shows up an hour later during precomputing.
- Trusting the file name alone. Two files both called
cleanmay have gone through different filters. Look atEEG.historyor the command history if in doubt. - Mixing old and new processing. A participant processed a year ago with old settings stays different even if everything in the main window matches.
- Forgetting that ICLabel runs per file. If you ran it for some participants only, precomputing removes components from some and leaves the rest.
- Data with a different mains frequency. D6 was recorded in France, where mains is 50 Hz. Your data in Saudi Arabia have 60 Hz. This does not matter within one STUDY whose files all went through the same steps, but it does when you combine data from two labs.
What mistakes do people make?
- Creating the STUDY before checking. A STUDY is created without error even if the files differ, and the problem shows up an hour later during precomputing.
- Trusting the file name alone. Two files both called
cleanmay have gone through different filters. Look atEEG.historyor the command history if in doubt. - Mixing old and new processing. A participant processed a year ago with old settings stays different even if everything in the main window matches.
- Forgetting that ICLabel runs per file. If you ran it for some participants only, precomputing removes components from some and leaves the rest.
- Data with a different mains frequency. D6 was recorded in France, where mains is 50 Hz. Your data in Saudi Arabia have 60 Hz. This does not matter within one STUDY whose files all went through the same steps, but it does when you combine data from two labs.
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.UndoHow do I write it in my paper?
A Methods template: edit the data, settings and versions to match what you ran
A template: edit the data, settings and versions to match what you ran.
Before group analysis, the datasets of all [14] participants were checked for identical sampling rate, epoch limits, channel labels and event types (EEGLAB 2026.1).How do I write it in my paper?
A template: edit the data, settings and versions to match what you ran.
Before group analysis, the datasets of all [14] participants were checked for identical sampling rate, epoch limits, channel labels and event types (EEGLAB 2026.1).Where can I read more?
4 sources, official docs first
- EEGLAB TutorialDocumentation10. Group analysis > a. Multiple subject processing overview
- EEGLAB TutorialDocumentation10. Group analysis > b. STUDY creation
- From raw data to group level analysis in EEGLABVideoFull video · 16:20
- Go-nogo categorization and detection task (OpenNeuro ds002680)README; dataset_description.json
Written for EEGLAB 2026.1 · 2026-10-28
Going further
- EEGLAB Tutorial: https://eeglab.org/tutorials/10_Group_analysis/multiple_subject_proccessing_overview.html (10. Group analysis > a. Multiple subject processing overview)
- EEGLAB Tutorial: https://eeglab.org/tutorials/10_Group_analysis/study_creation.html (10. Group analysis > b. STUDY creation)
- From raw data to group level analysis in EEGLAB: https://www.youtube.com/watch?v=-jL3PuHD3aY (Full video)
- Go-nogo categorization and detection task (OpenNeuro ds002680): https://openneuro.org/datasets/ds002680 (README; dataset_description.json)
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".