ERPLAB Toolbox Scripting Guide
ERPLAB TOOLBOX SCRIPTING GUIDE
Important note: Because this is not commercial software, bugs are inevitable. In some cases, errors will occur leading to a message that instructs you to report the error to the EEGLAB developers. If this happens, please report the error to us at firstname.lastname@example.org and not to the EEGLAB developers. ERPLAB has primarily been tested using EEG collected with a Biosemi ActiveTwo System, along with a smaller amount of testing using EEG collected with Neuroscan and EGI systems.
ERPLAB is in a rapid period of transition, particularly with respect to scripting. Many changes in the function parameters were made in version 3.0, and scripts written for previous versions will need to be completely overhauled to run in this version. We will attempt to maximize backward compatibility in future versions.
You can do a lot in ERPLAB without ever writing a script. However, scripting can save you a lot of time by automating the processing of each subject. That way, when a reviewer asks you to reanalyze all of your data with different EEG filter settings, you won't have to manually re-do every subsequent processing step for every subject. In addition, scripting can allow you to perform analyses that aren't built into ERPLAB (or that have never been done before).
Scripting sounds complicated, but EEGLAB includes some features that make it easy, and ERPLAB inherits and extends those features. Specifically, when you perform a set of steps in the GUI, these steps are equivalent to a set of script commands, and EEGLAB and ERPLAB save the equivalent scripts in a history. You can then use the history to figure out the appropriate script commands. The next section will explain how to access the history, and then we will go through some examples.
This Scripting Guide does not assume that you know anything about programming in Matlab (or in any other language). To make the best use of ERPLAB, however, it is useful to learn a little bit about Matlab programming. We will teach you a little here, but only a little. It would be a good idea for you to have a book on Matlab programming to learn more and to consult if you run into problems. There are several available Matlab books, and any of them would probably be fine. Our lab uses Mastering Matlab by Hanselman and Littlefield.
Very Important Note: The histories and script examples given here won't look exactly like your histories and scripts, mainly because of differences in where the files and folders are stored. If the scripts aren't working correctly, this is likely the source of the problem. Also, Matlab often has problems when special characters (especially spaces) are in a filename or folder name. So, if the same data are stored in a folder named 'Sample' that is inside a folder named 'ERPLAB' that is inside a folder named 'In Progress (new)', you may need to change the name of the 'In Progress (new)' folder to 'In_Progress_new'.
Table of Contents
- Downloading the example data
- Accessing the history
- Organizing your files
- Keeping the GUI synced with your scripts
- If you already know a little about scripts or programming…
- Getting started
- Loading a dataset with the GUI to create a history
- Executing a command from the command line
- Using eeglab redraw to synchronize with the GUI
- Creating and executing the script
- Getting Started
- Doing the processing steps with the GUI to create a history
- Using the history to make a script
- Learning a little Matlab trick
- Adding subject and path variables to the script
- Averaging from EEG instead of ALLEEG
- Putting the bin descriptor file in the parent folder
- Changing the path for the electrode locations file