EEGLAB/MATLAB deep learning demo

This repository is a demo of a deep-learning EEG model in MATLAB. This corresponds to a published paper in the description.
Updated 15 Dec 2023

Open in MATLAB Online View EEGLAB/MATLAB deep learning demo on File Exchange

SCCN deep learning demo

This repository is a demo of a deep-learning EEG model in MATLAB. In this example, we use a large public EEG dataset from the Child Mind Institute, a non-profit organization for the advancement of children's mental health. A subset of the dataset is used to train the existing convolutional neural network classification model R-VGG_noNormalization. Furthermore, we take advantage of the MATLAB Array Datastore introduced in R2021a to facilitate the handling of large files that might not fit in memory.

The dataset is produced and shared as part of the Healthy Brain Network (HBN) project led by the Child Mind Institute. The HBN initiative efforts resulted in the creation and public sharing of a dataset from children and adolescents (ages 5-21), including up to 10,000 subjects. The multi-modal brain recordings (EEG, MRI, fMRI) and a number of behavioral/physiological measures were collected during resting-state and performance on a variety of cognitive tasks. A subset of the dataset used in this demonstration includes the EEG of 1,574 subjects performing a resting-state task. EEG recordings were performed in a sound-shielded room using a 128-channel EEG by Electrical Geodesics Inc. (EGI). During the recording, which lasted 5 minutes, subjects were instructed to open or close their eyes at various time points while viewing a fixation cross located at the center of the screen. Individual subjects contributed ~80 sec of recordings during eyes closed periods.

The data was preprocessed using EEGLAB, a versatile toolbox for EEG analysis developed at the Swartz Center for Computational Neuroscience (SCCN). Data preprocessing included the mean baseline removal, down-sampling to 128 Hz, band-pass filtering (0.25-25 Hz), and re-referencing to the averaged mastoids. The example demonstrates the transfer learning capability of a model pre-trained on image classification, showing high performance in the classification of biological sex based on multivariate EEG signals following just a few training cycles.

This corresponds to the published work:

Truong, D., Milham, M., Makeig, S., & Delorme, A. (2021). Deep Convolutional Neural Network Applied to Electroencephalography: Raw Data vs Spectral Features. Annual International Conference of the IEEE Engineering in Medicine and Biology Society. IEEE Engineering in Medicine and Biology Society. Annual International Conference, 2021, 1039–1042.

Check here to see the MATLAB LiveScript.

Original repository itself a submodule in the released code available at


This work was partially supported by a GIFT from Mathworks. Ivan Skelin, PhD, assisted in creating the LiveScript demo.

Cite As

Arnaud Delorme (2024). EEGLAB/MATLAB deep learning demo (, GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2023b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on EEG/MEG/ECoG in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Versions that use the GitHub default branch cannot be downloaded

Version Published Release Notes

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.