-
Notifications
You must be signed in to change notification settings - Fork 73
Scripting Guide
This tutorial was written for Version 4.0 of ERPLAB, but most things should work with later versions. If you find cases where this tutorial does not work with the current version of ERPLAB, please let us know.
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'.
- Getting Started With This Scripting Guide
- Example 1: The World's Simplest EEGLAB/ERPLAB Script
- Example 2: An Even Simpler EEGLAB Script
- Example 3: A Simple Script That Actually Does Something Useful
- Example 3b: Modifying the Script to Work for Different Subjects
- Example 3c: Looping Through Multiple Subjects
- Example 4: A Complete Data Processing Script
- Hints About Debugging Your Scripts