11: EEGLAB and ERPLAB Scripting

Applied Event-Related Potential Data Analysis 2e · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    Read aloud

    How

    Speed: 1×
    Light up
    Highlight

    Symbols: Mulberry Symbols, © 2018–2026 Steve Lee, CC BY-SA 4.0 (licence, the set), the site's own copies.

    From LibreTexts, under CC BY-NC 4.0, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    11: EEGLAB and ERPLAB Scripting
    Learning Objectives

    In this chapter, you will learn to:

    • Use the Matlab command line to execute EEGLAB and ERPLAB routines.
    • Efficiently move back and forth between scripts and the GUI to have the best of both worlds.
    • Use the EEG and ERP histories to see the commands that correspond to the EEGLAB and ERPLAB procedures that you run from the GUI.
    • Create simple scripts by copying commands from the EEG and ERP histories into a text file.
    • Use variables to define paths in a way that avoids problems and makes it easy to move your scripts and data to new locations.
    • Use loops so that you can efficiently repeat a set of processing steps on the data from multiple participants.
    • Read from and write to spreadsheets and text files to increase the power and flexibility of your scripts.
    • Create an entire processing pipeline that begins with the raw EEG and ends with amplitude and latency scores that are ready for statistical analysis.
    • Implement good programming practices that will minimize errors and increase the readability of your code.

    You can do a lot with the ERPLAB Studio GUI. However, you will eventually grow tired of all the pointing and clicking, especially the seventh time you reanalyze the data from an experiment (and believe me, you will be lucky if it’s only seven times). It’s straightforward to write Matlab scripts that automate almost every processing step. Scripts can also help you avoid the errors that inevitably arise in the thousands of clicks required to conduct every processing step for every participant. Better yet, scripts can allow you to implement new or modified processing steps, making your research more innovative. Scripts also play an important role in open science: When you publish a paper, you can make your data and scripts available (e.g., using the Open Science Framework), and then the world can see exactly how you processed the data and can exactly reproduce your analysis methods. These are the reasons why this whole chapter is devoted to scripting.

    This chapter is written so that it will be valuable both for people who don't know anything about Matlab scripting, people who are experts at Matlab programming, and everyone in between. Over the various exercises in this chapter, you will gradually build up a very sophisticated script. You will start with a script that simply loads one EEGset, and then you will add more and more elements until you have a script with a whole processing pipeline.


    This page titled 11: EEGLAB and ERPLAB Scripting was last modified on Thu, 01 Oct 2026 18:52:27 GMT and is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Steven J Luck directly on the LibreTexts platform.