Personal tools
You are here: Home ERPlab ERPLAB Documentation and Utilities ERPLAB Scripting Guide (v3.0)

ERPLAB Toolbox Scripting Guide

ERPLAB TOOLBOX SCRIPTING GUIDE

Version 3.0

12 October 2012

 

Scripting Guide written by Steve Luck with updates by Eric Foo

ERPLAB Toolbox core designed by Javier Lopez-Calderon and 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.

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

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

Document Actions
« May 2013 »
May
MoTuWeThFrSaSu
12345
6789101112
13141516171819
20212223242526
2728293031