Scripting Guide

apearman edited this page Oct 16, 2016 · 15 revisions
Clone this wiki locally

ERPLAB TOOLBOX SCRIPTING GUIDE

By Steve Luck

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 erplab@erpinfo.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.

Version 4.0 is intended to be backward compatible with version 3.0 with respect to scripting (but not with version 2.0). Many parameter names have changed, but the old parameters should still work. If you find cases where the old parameter name no longer works, please let us know. One exception is that the pop_averager routine now calculates the standard error rather than the standard deviation, so this parameter has been changed from 'Stdev' to 'SEM'.

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