Station 2 · Lesson 1

Importing raw files: EDF, BDF & BrainVision

Core15 minBefore this lesson: The EEG structurePrint the card
Starts from: S001R03.edf (D2) · Nothing yet: the data as downloaded.Download the data (opens in a new tab)
Script to reach this state
MATLAB
[ALLEEG, EEG, CURRENTSET, ALLCOM] = eeglab;
% Folder where you keep the course data (change it)
dataFolder = 'C:\Users\me\Documents\eeg-course';
if ~exist(dataFolder, 'dir'), mkdir(dataFolder); end
websave(fullfile(dataFolder, 'S001R03.edf'), ...
    'https://physionet.org/files/eegmmidb/1.0.0/S001/S001R03.edf');

The idea in brief

Every EEGA recording of the brain's electrical activity from electrodes on the scalp. system saves its recordings in its own format. EEGLAB, however, works on a single structure: the EEG structA MATLAB variable that groups several named fields together..

Importing turns the system’s file into this structure: the signalValues that change over time, such as the voltage recorded on a channel., the channelThe signal recorded from one electrode, as shown in EEGLAB. names, the sampling rateThe number of samples recorded per second on each channel. and the events.

Any mistake here carries into every later step. A missing channel or lost events means a wrong analysis from the start.

Before and after

Show
The EEGLAB main window before import: no data loaded, showing "No current dataset".
Before importScreenshot of the EEGLAB interface (SCCN)
The EEGLAB main window after importing the EDF file: 64 channels per frame, 20000 frames, 29 events, sampling rate 160 Hz, and Channel locations "No (labels only)".
After importScreenshot of the EEGLAB interface (SCCN)

Your next questions, each answered in its own section:

How do I do it in EEGLAB?

14 steps in the menus

1. Download the practice file

We use one file from the open PhysioNet datasetOne EEG data file loaded in EEGLAB together with its information. on hand movement and motor imagery: S001R03.edf. It has 64 channels at 160 Hz, lasts about two minutes, and stores its events inside the file.

  1. Open the dataset page: EEG Motor Movement/Imagery Dataset.
  2. Go into the S001 folder and download S001R03.edf.
  3. Put it in a folder for these lessons, away from the EEGLAB folder.

2. Import the file

  1. In the EEGLAB window, open: File then Import data then Using EEGLAB functions and plugins then From EDF/EDF+/GDF files (BIOSIG toolbox)
  2. If Biosig is not installed, EEGLAB asks to download it. Click Yes.
  3. Select the file S001R03.edf.
  4. The Load data using BIOSIG — pop_biosig() window opens. Leave every field at its default value:
    • Channel list (default all): empty, meaning all channels.
    • Data range (in seconds) to read (default all [0 …]) empty, meaning the whole recording.
    • Import EDF+ annotations (try also mexSLOAD below) ticked. Annotations are text notes stored inside an EDF+ file with their timing, and the events in this file come from them.
  5. Click OK.

3. Name the dataset and save it

  1. A window opens to name the new dataset. In the Name it: field, type S001R03.
  2. Tick Save it as file: and choose a name such as S001R03.set in your lessons folder.
  3. Click OK.

Saving as .set means you will not repeat the import in the next lesson. The original .edf file stays as it is.

4. A BDF or BrainVision file instead of EDF

  • BDF (BioSemi systems): the same pluginA package that adds new functions or menus to EEGLAB., from File then Import data then Using EEGLAB functions and plugins then From Biosemi BDF file (BIOSIG toolbox). Type a referenceThe point against which each channel's voltage is measured. channel number in the Reference chan(s) indices - recommended for BIOSEMI field, such as the two mastoid channels. The channel number depends on your electrodeThe physical sensor placed on the scalp to pick up the signal. order, so check your system’s montage file. The reason is under “Common mistakes”.
  • BrainVision (Brain Products systems): a recording is three files with the same name: .vhdr, .vmrk and .eeg. Open File then Import data then Using EEGLAB functions and plugins then From Brain Vis. Rec. .vhdr file and select the .vhdr file. If the bva-io plugin is not installed, EEGLAB offers to download it. After installation the menuA list of commands that opens from its name at the top of the window. is called From Brain Vis. Rec. .vhdr or .ahdr file.
  • A format you do not know: try File then Import data then Using the FILE-IO interface, then File then Import data then Using the BIOSIG interface. If both fail, search for your system’s name in File then Manage EEGLAB extensions. The documentation says these steps work in about 90% of cases.

From a scriptA MATLAB file of commands that runs processing steps in order., the first two formats look like this. The file names are examples:

MATLAB
% BioSemi BDF: pick a temporary reference at import. Here: the average of
% the external mastoid electrodes EXG1 and EXG2 (channels 65 and 66 in a
% 64-channel cap). Check the channel order of your own montage.
EEG = pop_biosig(fullfile(dataFolder, 'sub01.bdf'), 'ref', [65 66]);

% BrainVision: give the folder and the .vhdr header file (needs bva-io)
EEG = pop_loadbv(dataFolder, 'sub01.vhdr');

How do I write it as code?

The same steps in 15 lines of MATLAB
MATLAB
% Start EEGLAB and get its main variables
[ALLEEG, EEG, CURRENTSET, ALLCOM] = eeglab;

% Folder where you saved S001R03.edf (change it)
dataFolder = 'C:\Users\me\Documents\eeg-course';

% Biosig is required for EDF/BDF files
if ~exist('sopen', 'file')
    plugin_askinstall('Biosig', 'sopen', true);
end

% Import the EDF+ file (all channels, events from annotations)
EEG = pop_biosig(fullfile(dataFolder, 'S001R03.edf'));

% Store it as a new dataset and save it as .set
[ALLEEG, EEG, CURRENTSET] = pop_newset(ALLEEG, EEG, 0, ...
    'setname', 'S001R03', 'gui', 'off');
EEG = pop_saveset(EEG, 'filename', 'S001R03.set', 'filepath', dataFolder);
eeglab redraw;

Which value should I choose?

Suitable values for your analysis goal

The main decision: which plugin reads your system’s files? All the menus below are under File then Import data then Using EEGLAB functions and plugins. If the plugin is not installed, EEGLAB offers to download it the first time you open its menu, as with Biosig.

Your systemFormatPluginMenuFunction
Many clinical and research systems, PhysioNet, and g.tec (GDF files)EDF, EDF+ or GDF: .edf, .gdfBiosigFrom EDF/EDF+/GDF files (BIOSIG toolbox)pop_biosig
BioSemiBDF: .bdfBiosigFrom Biosemi BDF file (BIOSIG toolbox)pop_biosig with 'ref'
Brain ProductsBrainVision: .vhdr, .vmrk and .eegbva-ioFrom Brain Vis. Rec. .vhdr file (after installation: From Brain Vis. Rec. .vhdr or .ahdr file)pop_loadbv
EGI / MagstimMFF: a .mff foldermffmatlabioImport Magstim/EGI .mff filepop_mffimport
Neuroscan.cntneuroscanioFrom Neuroscan .CNT filepop_loadcnt
ANT Neuro (eego)EEProbe .cntANTeepimportFrom ANT EEProbe .CNT filepop_loadeep_v4
Any system recorded through Lab Streaming Layer (LSL)XDF: .xdfxdfimportFrom .XDF or .XDFZ filepop_loadxdf
Any system that exports the signal as text or numbers, or data you already have in MATLABASCII or float file, or a MATLAB arraynone, built into EEGLABFrom ASCII/float file or MATLAB arraypop_importdata
  • A Neuroscan .cnt and an ANT .cnt are two different formats with the same extension. Choose by the system, not by the extension.
  • If you do not find your system, search for its format name in File then Manage EEGLAB extensions.

Two fields worth your attention in the Biosig window:

FieldValueWhy
Import EDF+ annotationsTicked (default)In EDF+ files, events come from the annotations. If you untick it, you lose the events.
Reference chan(s) indices - recommended for BIOSEMIEmpty for EDF, a reference channel for BDFThe pop_biosig help page warns that BioSemi data are recorded reference-free and lose about 40 dB (decibel)A logarithmic scale for power that makes large and small values easy to compare. of signal-to-noise ratio if left without a reference. This is a temporary reference; you choose the final one in the re-referencing lesson.

How do I check it worked?

5 quick checks
  1. The main window: under the dataset name, read Channels per frame = 64, Sampling rate (Hz) = 160, and Events above zero. Channel locations shows No (labels only), meaning the channel names are there without locations. This is expected for now; we add the locations in the next lesson.
  2. From the Command Window: EEG.nbchan gives 64, EEG.srate gives 160, and EEG.pnts / EEG.srate gives the length in seconds (about two minutes).
  3. The events: eeg_eventtypes(EEG) lists the three codes T0 (rest), T1 and T2 (two movements, depending on the task). If the event count is zero, import again and check the annotations field.
  4. By eye: open Plot then Channel data (scroll). You should see the channels with a changing signal, and colored vertical lines at the events.
  5. The saved file: S001R03.set should appear in your lessons folder.
About the data

Data: Schalk, G. (2009). EEG Motor Movement/Imagery Dataset (version 1.0.0). PhysioNet. DOI: 10.13026/C28G6P. License: Open Data Commons Attribution v1.0. Along with the original paper: Schalk et al. (2004), IEEE Transactions on Biomedical Engineering 51(6):1034-1043. And the standard PhysioNet citation: Pollard, T., Moody, B. E., Lehman, L., Gow, B., Fernandes, C., Xie, C., Johnson, A., Mark, R. G., & Heldt, T. (2026). PhysioNet as a global platform for biomedical research. Nature Health. https://doi.org/10.1038/s44360-026-00096-z

Keep this file. The next two lessons (channel locations and events) continue on it.

What mistakes do people make?

5 mistakes and how to avoid them
  • Picking the wrong BrainVision file. Always open the .vhdr file, not .eeg or .vmrk. And do not rename one of the three files by hand, because the .vhdr file stores the names of the other two inside it. If you need to rename them, use File then Export then Copy and Rename Brain Vis. exchange files after installing bva-io.
  • A BDF file without a reference. You lose a large part of the signal quality, as in the table above. Choose a reference channel at import.
  • Turning off event import. The Biosig window has two event fields, both ticked by default for every format: Import EDF+ annotations and Extract event from marker channel. If you untick them, the event count may drop to zero, and you cannot epoch the data later.
  • Not saving after import. You will repeat the import every time. Save one .set copy after import, and never overwrite the original file.
  • Odd channel names in this file. The channel names in this dataset end with dots, such as Fc5. and C3... This is not an import error, but it stops EEGLAB from recognizing the electrode locations. We fix it in the next lesson.

How 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.

EEG recordings in EDF+ format (64 channels, 160 Hz) were imported into EEGLAB 2026.1 with pop_biosig (Biosig plugin [version]), and event markers were read from the EDF+ annotations.

Where can I read more?

4 sources, official docs first

Written for EEGLAB 2026.1 · 2026-10-28

Need help?

Ask, share feedback, or report an error