What is EEGLAB?
EEGLAB is an interactive Matlab toolbox for processing continuous and event-related EEG, MEG and other electrophysiological data incorporating independent component analysis (ICA), time/frequency analysis, artifact rejection, event-related statistics, and several useful modes of visualization of the averaged and single-trial data. First developed on Matlab 5.3 under Linux, EEGLAB runs on Matlab v5 and higher under Linux, Unix, Windows, and Mac OS X (Matlab 7+ recommended).
There are eight key steps to be performed before starting the analysis of EEG data using EEGLAB, which includes preprocessing, extracting epochs and ICA decomposition.
Step 1. Start MATLAB and EEGLAB
Start EEGLAB by typing “eeglab” at the MATLAB command line and press enter.
The blue main EEGLAB window below will pop up, with tits seven menu headings:
Step 2. Import data and channel locations
Importing the data (in this work a MATLAB array format data) in EEGLAB by selecting File\Import data\Using EEGLAB functions and plugins\From MATLAB array.
Uploading data in EEGLAB might be a little bit challenging for the ones that have never used it before. In the slide below you the correct format of EEG data and channel locations.
After loading the channel locations, down sampling of the EEG data may be done to save memory and disk storage. However, in my work I registered the signals with a 250 Hz frequency sampling, which is an acceptable value.
Since a MATLAB file data is recorded without any reference, a reference channel should be mentioned while importing it into the EEGLAB. You can either the compute average reference or any channel(s) that you want.
Step 3. Import events
Importing the data from a “.txt” file in EEGLAB by selecting File\Import data\From MATLAB array it is the perfect option if you have the event information apart from the EEG data.
As the previous step, uploading event information is tricky with EEGLAB. The right way to upload the event file is by writing three different columns called “Latency”, “Type”, and “Duration” with the following information:
- Latency: you must write the time when the event took place.
- Type: type of the event (you can distinguish among different ones).
- Duration: for how low did it last.
In the pop-up window that appears, enter information about the events. Select “Browse”, and enter the name of the variable where your matrix is stored. Enter the column names in order (in my case as it is shown in the figure above). Since the first row has the titles of the columns, we write a “1” in the second spot. Also, our latency values are in milliseconds (ms). Thus, we need to write “1E-3” in the third spot. The other fields can be left at default, and EEGLAB will automatically fill in the information from the data set.
Step 4. Filter the data
EEG data is filtered using both high pass and low pass filters for removing linear trends. Select Tools\Filter the data \Basic FIR filter, and then enter the cut-off frequency. If high-pass and low-pass cutoff frequencies are both selected, the filtering routine may not work. So first, apply the low-pass filter and then, in a second call, the high-pass filter.
Step 5. Extracting epochs
To study the event-related EEG dynamics of continuously recorded data, the data epochs time locked to events of interest should be extracted. To extract epochs, select Tools\Extract epochs. Then select the event to be extracted and the length of the epoch to be extracted.
Step 6. Remove baseline values
Removing a mean baseline value from each epoch is useful when baseline differences between data epochs (e.g., those arising from low-frequency drifts or artifacts) are present. These are not meaningfully interpretable, but if left in the data could skew the data analysis. After the data has been epoched, a window will pop up automatically asking for baseline removal. Also, the baseline can be removed by selecting select Tools>Remove baseline.
Step 8. Calculate ICA Components
To compute ICA components of a dataset of EEG epochs (or of a continuous EEGLAB dataset), select Tools\Run ICA. This calls the function pop_runica(),an automated version of the infomax ICE algorithm.
- What is EEGLAB? http://sccn.ucsd.edu/eeglab/
- EEGLAB Tutorial: http://sccn.ucsd.edu/wiki/EEGLAB_TUTORIAL_OUTLINE
- EEGLAB Wiki: http://sccn.ucsd.edu/wiki/EEGLAB
- Online EEGLAB Workshop: http://sccn.ucsd.edu/wiki/Online_EEGLAB_Workshop