The Neurophysiological Biomarker Toolbox (NBT)

Table of Contents

Plotting ERPs in EEGLAB

This section is a step-by-step tutorial in how to plot the ERPs following target trials, standard trials and their difference at all electrode locations organized in a scalp topography. This allows you to visually compare temporal and scalp distribution of the ERP, which can give you a good idea of your data. If all goes well, you should obtain a plot like this:

See the EEGLAB wiki for more information (scroll down to “the EEGLAB tutorial outline”).


  1. Open Matlab
  2. Make sure the Current Directory is set to your NBT folder.
  3. Type 'installNBT'
  4. Type 'eeglab'. The screen in the figure below will appear.

  5. Importing your data: File > import data > from BCI2000 .dat file
    • Select BCI Events 'StimulusBegin and 'StimulusType'.
    • Give the data set a name.

  6. Re-referencing your data to Common Average Reference:
    • Tools > Re-reference
    • Choose Common Average Reference, click OK.
    • Give the new data set the same or a different name.
    • Because EEGLAB tends to get slower the more data sets are loaded, especially with large data files, you could delete data sets you are not going to use by selecting Edit > Delete dataset(s), entering its data set number and clicking OK.

  7. Extracting the epochs: Tools > extract epochs

    • click the '…' button next to 'Time-locking event type(s)' and select StimulusBegin.
    • Choose an appropriate start and end window for the epochs, such as '0 0.8'. These values need to be entered in seconds.
    • The word 'epochs' is automatically added behind the name of the data set from which you extracted the epochs. Click OK if you agree with the name for the new data set.
    • If you want to save the new data set to disk, in the next window “pop_newset()” you can check the box 'Save it as file', enter a file name and click OK. If not, click OK as well without checking the box.
    • Epoch baseline removal: to make sure that the P300s of different electrodes are compared to a similar baseline signal, we subtract the average signal of 0 to 100 ms from the whole epoch (0 to 800 ms). Enter the baseline latency range '0 100'.

  8. Load the electrode locations: this is required if you want to see the ERPs of all electrodes in a scalp topographic fashion. To do this, go to:
    • Edit > Channel locations
      • Read Locations (bottom left) > locate the file 'GSN-HydroCel-129.loc' (in NBT/supportfunctions) and double-click it.
      • Click OK in the next window where 'autodetect' is selected in the list.
      • Click OK

  9. Create separate data sets for target and non-target epochs:
    • Edit > select epochs or events

      • latency: 0 for min and 1 for max
      • type: select StimulusType from the '…' button
      • position: 1
      • Click OK and confirm
      • Give the new data set an appropriate name, like “target responses”
    • Create data set with only non-target epochs by removing all target epochs:
      • Select the data set with the extracted epochs
      • Do the same, but now also select 'invert epoch selection'. A name could be “non-target responses”
      • Click OK and confirm

  10. To plot the ERP waveforms: Plot > Sum/compare ERPs

    • Datasets to average: the number of the target data set
    • Datasets to average and subtract: the number of the non-target data set
    • Channels subset: []
    • Plottopo options: 'ydir', 1, 'ylim', [lowest amplitude, highest amplitude]
      • this plots positive potentials as upward spikes when ydir is 1 and as downward spikes when it is -1. ylim sets the range of muV to display.
      • Click OK
    • After the plot has loaded, you can click on any electrode location to make a plot of that electrode's waveform.
courses/analysing_your_data.txt · Last modified: 2011/10/11 22:31 by Klaus Linkenkaer-Hansen
The NBTwiki platform - version 2.8 - 9 May 2013
Copyright (C) 2008-2015