Simply EEGLAB
Organizing files & storage
Station 9 · Lesson 5 · EEGLAB 2026.1
In the GUI
- FileSave current dataset asEditDataset infoDataset name
- FileBIDS toolsBIDS export wizard (from raw EEG to BIDS)
- FileBIDS toolsExport STUDY to BIDS folder
- FileBIDS toolsValidate BIDS dataset
Script
[ALLEEG, EEG, CURRENTSET, ALLCOM] = eeglab;
eeglabRoot = fileparts(which('eeglab'));
projectRoot = pwd; % run from inside faces_project
bidsRoot = fullfile(projectRoot, 'rawdata'); % ds002718 lives here
derivRoot = fullfile(projectRoot, 'derivatives', 'eeglab');
folders = {bidsRoot, derivRoot, fullfile(projectRoot, 'code'), ...
fullfile(projectRoot, 'figures'), fullfile(projectRoot, 'logs')};
for k = 1:numel(folders)
if ~exist(folders{k}, 'dir'), mkdir(folders{k}); end
end
rawFiles = dir(fullfile(bidsRoot, 'sub-*', 'eeg', '*_eeg.set'));
rawGB = sum([rawFiles.bytes]) / 1e9;
nSubjects = numel(rawFiles);
fprintf('%d subject(s) on disk, %.2f GB of raw data\n', nSubjects, rawGB);
nSavedStages = 2; % clean continuous + epochs
fprintf('Derivatives for these subjects: up to about %.1f GB\n', rawGB * nSavedStages);
fprintf('Full dataset (18 subjects): about %.1f GB raw\n', 18 * rawGB / max(nSubjects, 1));
subj = 'sub-002';
stage = 'clean';
outDir = fullfile(derivRoot, subj, 'eeg');
if ~exist(outDir, 'dir'), mkdir(outDir); end
outName = sprintf('%s_task-FaceRecognition_desc-%s_eeg.set', subj, stage);
fprintf('Save stage "%s" as %s\n', stage, fullfile(outDir, outName));
data = struct('file', {fullfile(eeglabRoot, 'sample_data', 'eeglab_data.set')});
bids_export(data, 'targetdir', fullfile(projectRoot, 'd1_bids'), ...
'tInfo', struct('TaskName', 'attention', 'PowerLineFrequency', 60));Which value should I choose?
| Decision | Choice in this lesson |
|---|---|
| Location of raw data | rawdata, read only |
| Location of results | derivatives/eeglab/sub-XXX/eeg |
| Number of saved stages | Two: the clean continuous version, then the epochs |
| Saved separately | ICA weights, bad channels, removed components |
| One or two files per dataset | Two files, .set and .fdt (the EEGLAB 2026.1 default) |
| Number format | single (EEGLAB default) |