11: EEGLAB and ERPLAB Scripting
-
-
Last updated
-
-
Save as PDF
-
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 EEGLAB and ERPLAB GUIs. 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.