A quick intro to EEGLAB
Last updated
Last updated
EEGLAB is an open source environment for electrophysiological signal processing run on the Matlab platform. A comprehensive tutorial on using EEGLAB is available on the EEGLAB Wiki: http://sccn.ucsd.edu/wiki/EEGLAB_Wiki
The EEGLAB mailing list is also an excellent resource for commonly (and not so commonly) asked questions. Access the EEGLAB mailing list by googling a question with EEGLAB in the title, or from the following link: http://sccn.ucsd.edu/wiki/EEGLAB_mailing_lists
To load raw data in to EEGLAB from external acquisition software, click on: File -> Import data -> Using EEGLAB functions and plugins. If the import file type required is not in this list, go to: File -> Manage EEGLAB extensions -> Data import extensions. Select the import file type required and click OK. Then repeat the initial steps.
Once data is imported to EEGLAB and has been saved (File -> Save current dataset), the data is loaded in to EEGLAB using: File -> Load existing dataset.
TESA is located under: Tools - > TMS-EEG signal analyser (TESA). If TESA is not present, ensure the TESA folder is pasted in to the plugins folder of the main EEGLAB folder. Close EEGLAB and re-launch from the command line.
Underneath the user interface, EEGLAB and TESA are both collections of Matlab functions. Functions are separate scripts that can be called by entering a single command into the command line or in a script. Functions require both inputs (data to run, settings etc.) and outputs (where to store the data once the computation is complete). EEGLAB functions have two levels: a base level which carries out the actual computation and a 'pop' level which generates the pop-up windows observed from the user interface. These functions have a common formula.
output = function_name( input1, input2, 'key1', value1 );
Base function.
output = pop_function_name( input1, input2, 'key1', value1 );
Pop function. To call the pop-up window, only enter input1.
Note that the number of inputs and key/value pairs can vary.
Examples
EEG = tesa_findpulse( EEG, 'Cz', 'rate', 1000 );
Example of a base function.
EEG = pop_tesa_findpulse( EEG, 'Cz', 'rate', 1000 );
Example of a pop function. This will behave the same way as the base function.
EEG = pop_tesa_findpulse( EEG );
Example of a pop function that will generate a pop-up window so inputs can be manually entered by the user.
function_name - is the name of the function (tesa_findpulse in the example). This calls a file by the same name stored in either the EEGLAB or TESA folder.
input - is a variable required as input for the function. This could be data stored in the workspace as a structure, matrix, string or cell, or a setting. Usually, the first input required (input1) is the EEG structure (EEG in the example). The second input in this example (input2) is an electrode ('Cz' in the example - the ' tells Matlab this is a string). The function will not run without the correct inputs.
'key'/value pairs - are optional inputs that are not necessarily required to run the function, but can be used to change the function settings. The 'key' is a string which tells the function what setting to change ('rate' in the example). The value tells the function what to change the setting to (1000 in the example. Note this could be an integer, string, matrix etc).
output - This is where to store the output from the function. Usually this is the EEG structure in the workspace (EEG in the example).
For each TESA function, the required inputs, outputs and key/value pairs are described at the beginning of each function (which can be accessed by typing help function_name
at the command line) and in tables in this user manual. See the example below for the tesa_findpulse function:
Input
Description
Example
Default
EEG
EEGLAB EEG structure
EEG
-
elec
string defining electrode to use for finding artifact
'Cz'
-
Key
Input value
Description
Example
Default
'refract'
integer
integer defines the refractory period (the time for the TMS artefact to recover below the rate of change). Integer is in ms.
2
3
'rate'
integer
integer defines the rate of change of the TMS artifact in uV/ms.
1e4
1e4
Output
Description
EEG
EEGLAB EEG structure