Using EEGLAB history for basic scripting

Similar documents
Using EEGLAB history for basic scripting

More EEGLAB Scripting

DSI-STREAMER TO EEGLAB EXTENSION

ERPEEG Tutorial. Version 1.0. This tutorial was written by: Sravya Atluri, Matthew Frehlich and Dr. Faranak Farzan.

The BERGEN Plug-in for EEGLAB

ADJUST: An Automatic EEG artifact Detector based on the Joint Use of Spatial and Temporal features

PREPROCESSING FOR ADVANCED DATA ANALYSIS

1. Introduction Installation and requirements... 2

TMSEEG Tutorial. Version 4.0. This tutorial was written by: Sravya Atluri and Matthew Frehlich. Contact:

M/EEG pre-processing 22/04/2014. GUI Script Batch. Clarification of terms SPM speak. What do we need? Why batch?

Source Reconstruction in MEG & EEG

A short tutorial for RIDE toolbox

1. Introduction Installation and requirements... 2

1. Introduction Installation and requirements... 3

Group ICA of EEG Toolbox (EEGIFT) Walk Through

BESA Research. CE certified software package for comprehensive, fast, and user-friendly analysis of EEG and MEG

MATLAB TUTORIAL WORKSHEET

A Framework for Evaluating ICA Methods of Artifact Removal from Multichannel EEG

Adapting to Non-Stationarity in EEG using a Mixture of Multiple ICA Models

P300 Accuracy V Copyright 2012 g.tec medical engineering GmbH

- Graphical editing of user montages for convenient data review - Import of user-defined file formats using generic reader

A Brief Introduction to MATLAB

P300 Spelling Device with g.mobilab+ and Simulink v Copyright 2012 g.tec medical engineering GmbH

Matlab Review. Dr. Mark Glauser, Created by: David Marr. Mechanical Engineering Syracuse University. Matlab Review p.

Exercise 6a: Using free and/or open source tools to build workflows to manipulate. LAStools

Using an ICPSR set-up file to create a SAS dataset

Desktop Command window

MATLAB BASICS. < Any system: Enter quit at Matlab prompt < PC/Windows: Close command window < To interrupt execution: Enter Ctrl-c.

Latency [ms] Nose RVF LVF. Fpz Fp2. Fp1 AF7 AF3 AF8 AF4. AFz F7 F5 F3. Fz F2 F4. FT7 FC5 FC3 FC1 FCz FT8 FC6 FC4 FC2. Cz C2 C4 C6 T8.

MEG & PLS PIPELINE: SOFTWARE FOR MEG DATA ANALYSIS AND PLS STATISTICS

CIS581: Computer Vision and Computational Photography Project 4, Part B: Convolutional Neural Networks (CNNs) Due: Dec.11, 2017 at 11:59 pm

Matlab for FMRI Module 1: the basics Instructor: Luis Hernandez-Garcia

Data needs to be prepped for loading into matlab.

OHBA M/EEG Analysis Workshop. Mark Woolrich Diego Vidaurre Andrew Quinn Romesh Abeysuriya Robert Becker

Introduction to MATLAB

PHYS 210: Introduction to Computational Physics MATLAB Exercises 2

EXERCISE 3 Extracting Plot Subsets

0.1. Setting up the system path to allow use of BIAC XML headers (BXH). Depending on the computer(s), you may only have to do this once.

An Introduction To Presentation MACCS

MATLAB for beginners. KiJung Yoon, 1. 1 Center for Learning and Memory, University of Texas at Austin, Austin, TX 78712, USA

Improved rejection of artifacts from EEG data using high-order statistics and independent component analysis

The PALOMA Eclipse Plug-in User Manual

Managing custom montage files Quick montages How custom montage files are applied Markers Adding markers...

Variability of ICA decomposition may impact EEG signals when used to remove eyeblink artifacts

A P300-speller based on event-related spectral perturbation (ERSP) Ming, D; An, X; Wan, B; Qi, H; Zhang, Z; Hu, Y

The value of f(t) at t = 0 is the first element of the vector and is obtained by

Matlab Tutorial. Get familiar with MATLAB by using tutorials and demos found in MATLAB. You can click Start MATLAB Demos to start the help screen.

MEG Laboratory Reference Manual for research use

MATLAB GUIDE UMD PHYS401 SPRING 2012

Important Upgrade Info for SPLM 2012

Matlab Tutorial and Exercises for COMP61021

Outline Introduction Goal Methodology Results Discussion Conclusion 5/9/2008 2

A QUICK INTRODUCTION TO MATLAB

Introduction to GNU-Octave

Introduction to programming in MATLAB

A QUICK INTRODUCTION TO MATLAB. Intro to matlab getting started

AMS 27L LAB #2 Winter 2009

Lecture 2 Introduction to MATLAB. Dr.Tony Cahill

Data and Function Plotting with MATLAB (Linux-10)

An Introduction to MATLAB See Chapter 1 of Gilat

COGS 119/219 MATLAB for Experimental Research. Fall Functions

Background: Bioengineering - Electronics - Signal processing. Biometry - Person Identification from brain wave detection University of «Roma TRE»

Introduction to Linux Part 2b: basic scripting. Brett Milash and Wim Cardoen CHPC User Services 18 January, 2018

D&C Scheme Editor 5.2 Release Notes

An Introduction to MATLAB. Lab tutor : Dennis Yang LIU Lab 1: Sept. 11, 2014

EOSC 352 MATLAB Review

Basic Imaging and Self- Calibration (T4 + T7)

EE3TP4: Signals and Systems Lab 1: Introduction to Matlab Tim Davidson Ext Objective. Report. Introduction to Matlab

Worksheet 1. Hello Matlab

m-tsne: A Framework for Visualizing High-Dimensional Multivariate Time Series

EGR 111 Introduction to MATLAB

MATLAB Introduction To Engineering for ECE Topics Covered: 1. Creating Script Files (.m files) 2. Using the Real Time Debugger

MATLAB An introductory tutorial

Matlab notes Matlab is a matrix-based, high-performance language for technical computing It integrates computation, visualisation and programming usin

Summer 2009 REU: Introduction to Matlab

Z-Score Quick Guide. This document describes how to prepare, configure and review a Z-Score measurement in BioTrace+.

MATLAB for Experimental Research. Fall 2018 Vectors, Matrices, Matrix Operations

EMERALD: Radar/Lidar Visualization and Manipulation Tool for MATLAB. User s Guide

ASA Getting Started. ANT BV, Enschede, Netherlands Advanced Neuro Technology

1-- Pre-Lab The Pre-Lab this first week is short and straightforward. Make sure that you read through the information below prior to coming to lab.

An Introduction to MATLAB

Matlab Tutorial, CDS

Introduction to R Programming

Matlab OTKB GUI Manual:

Classification using Weka (Brain, Computation, and Neural Learning)

Matlab Programming MET 164 1/24

Introduction to MATLAB

CSE/NEUBEH 528 Homework 0: Introduction to Matlab

Group Sta/s/cs with BESA and BrainWave

Data Science and Machine Learning Essentials

EE289 Lab Spring 2012

Introduction to Octave/Matlab. Deployment of Telecommunication Infrastructures

Lab P-1: Introduction to MATLAB. 3. Learn a little about advanced programming techniques for MATLAB, i.e., vectorization.

Matlab Tutorial for COMP24111 (includes exercise 1)

Lecture 2 Matlab Environment

MEG and EEG analysis using

Intro to Matlab for GEOL 1520: Ocean Circulation and Climate or, Notions for the Motions of the Oceans

MEG and EEG analysis using

MATLAB - Lecture # 4

MATLAB Part 2. This week we will look at techniques which will allow you to build powerful applications in MATLAB

Transcription:

Using EEGLAB history for basic scripting EEG.history useful information Task 1 Create simple script using 'eegh' Exercise... Task 2 Eye-blink correction Create a new EEG field Exercise... Task 3 Script to process multiple data sets Exercise... EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 1

The example data: faces vs. objects Data Task 33 channel EEG, nose-tip reference, 250 Hz sampling rate, 0.5-100 Hz, 16 bit, BrainAmps speeded discrimination between objects and faces, 500 ms presentation duration, ISI 500-1900 ms, 362 trials EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 2

Using EEGLAB history for basic scripting EEG.history useful information Task 1 Create simple script using 'eegh' Exercise... Task 2 Eye-blink correction Create a new EEG field Exercise... Task 3 Script to process multiple data sets Exercise... EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 3

Task 1: Retrieve dataset history How do I retrieve information about the processing history of a data set? >> EEG.history EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 4

EEG.history >> EEG.history ans = EEG = pop_loadbv('.../data/rawdata/', 'faces_4.vhdr'); EEG.setname='faces_4_continuous'; EEG = eeg_checkset( EEG ); EEG.chanlocs=pop_chanedit(EEG.chanlocs, 'load',[],... 'load',{ '.../wsporto/data/chan_locs.elp', 'filetype',... 'besa (elp)'}, 'eval',... 'chantmp = pop_chancenter( chantmp, [],[]);'); EEG = pop_saveset( EEG, 'faces_4.set', '.../workshop/'); EEG = pop_multifit(eeg, [1:33], 'settings',{},'threshold',... 40, 'plotopt',{ 'normlen', 'on', 'image','fullmri'}); pop_topoplot(eeg,0, [1:12], 'faces_4 continuous',... [3 4],0, 'electrodes', 'off', 'masksurf', 'on'); % no history for manual DIPFIT dipole localization EEG = pop_saveset( EEG, 'faces_4.set', '.../workshop/'); EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 5

Using EEGLAB history for basic scripting EEG.history useful information Task 1 Create simple script using 'eegh' Exercise... Task 2 Eye-blink correction Create a new EEG field Exercise... Task 3 Script to process multiple data sets Exercise... EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 6

Task 1: plot an ERP image EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 7

Task 1: Plot an ERPimage... EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 8

Task 1: Resulting figure EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 9

Script task 1 using 'eegh' How do I write a script to do this? >> eegh EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 10

Script task 1 using 'eegh' >> eegh [ALLEEG EEG CURRENTSET ALLCOM] = eeglab; EEG = pop_loadset('filename','faces_4.set','filepath',... '...\data\'); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, 0); EEG = pop_epoch( EEG, { 'face' 'object' }, [-0.2 0.8],... 'newname', 'faces_4 epochs', 'epochinfo', 'yes'); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, 1); EEG = pop_rmbase( EEG, [-200 0]); [ALLEEG EEG] = eeg_store(alleeg, EEG, CURRENTSET); figure; pop_erpimage(eeg,1, [21],[],'e21',10,1,{},[],... '','yerplabel','\muv','topo',... { [21] EEG.chanlocs EEG.chaninfo },'erp','cbar'); EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 11

Exercise >> eeglab % repeat all steps of task 1: % load dataset, % epoch on 'face' and 'object' % plot erpimage for any channel >> eegh % open Matlab editor: >> edit % copy & paste eegh results into a new % file and save it (../faces1.m) >> clear >> close all >> faces1 >> eeglab redraw EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 12

Using EEGLAB history for basic scripting EEG.history useful information Task 1 Create simple script using 'eegh' Exercise... Task 2 Eye-blink correction Create a new EEG field Exercise... Task 3 Script to process multiple data sets Exercise... EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 13

Eye blink correction How do I identify eye-blink components? EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 14

Eye blink correction EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 15

Eye blink correction EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 16

Eye blink correction EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 17

Eye blink correction Trial 43: Fp1/2 before (b) and after (r) correction EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 18

Task 2: Eye blink correction EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 19

Task 2: Script an addition to EEG structure EEG structure can be extended to include new fields -Useful procedure to store information that may be accessed in future scripts Task: write a semi-automatic script to save eye blink component index as EEG.blink EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 20

Access functions by pop menus >> eeglab % load dataset, % plot component maps in 2D % save current dataset as... (force a resave) >> eegh % open Matlab editor: >> edit % copy & paste eegh results into a new % file and save it as faces2.m EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 21

Task 2: Modify faces2.m % faces2.m % infile = 'faces_3.set'; % define input.set file inpath = 'C:\Documents and Settings\Administrator\... EEGLAB workshop\data\'; %input directory % start eeglab [ALLEEG EEG CURRENTSET ALLCOM] = eeglab; % load data set EEG = pop_loadset(infile, inpath); [ALLEEG EEG CURRENTSET] = eeg_store(alleeg, EEG); % plot IC maps pop_topoplot(eeg,0, [1:size(EEG.data,1)],infile,... [6 6],0,'electrodes', 'off', 'masksurf', 'on'); EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 22

Task 2: Scripting ICA eye blink correction % faces2.m (cont'd) % Enter eye blink indices manually EEG.blink = input('enter eye blink component indices: '); % save info in current data set EEG = pop_saveset(eeg, infile, inpath); [ALLEEG EEG] = eeg_store(alleeg, EEG, CURRENTSET); % update EEGLAB gui eeglab redraw; EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 23

Exercise: Script it yourself % faces2.m infile = 'faces_3.set'; For reference: example script saved as: inpath = '...\data\'; ' \EEGLAB workshop\scripts\practicum_4.m' % start eeglab [ALLEEG EEG CURRENTSET ALLCOM] = eeglab; % load data set EEG = pop_loadset(infile, inpath); [ALLEEG EEG CURRENTSET] = eeg_store(alleeg, EEG); % plot IC maps pop_topoplot(eeg,0, [1:size(EEG.data,1)],infile,... [6 6],0,'electrodes', 'off', 'masksurf', 'on'); % Enter eye blink indices manually EEG.blink = input('enter eye blink component indices:'); % save info in current data set EEG = pop_saveset(eeg, infile, inpath); [ALLEEG EEG] = eeg_store(alleeg, EEG, CURRENTSET); eeglab redraw; EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 24

Using EEGLAB history for basic scripting EEG.history useful information Task 1 Create simple script using 'eegh' Exercise... Task 2 Eye-blink correction Create a new EEG field Exercise... Task 3 Script to process multiple data sets Exercise... EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 25

Task 3: Compare conditions within subject From the gui, perform the following operations: 1) Load the dataset 2) Subtract ICA eye blink component activity 3) Epoch data (-200 to 800 ms) on 'object' and 'face' events 4) Compare the ERPs of both conditions * Use: Plot Sum/Compare ERPs 5) Use 'eegh' to retrieve commandline functions - clear dataset THEN: Write a script doing all this automatically ** Use a for loop and variables for maximum efficiency EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 26

Task 3: GUI functions (review) EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 27

Task 3: GUI functions, cont'd EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 28

Task 3: GUI functions, cont'd EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 29

Task 3: GUI functions, cont'd EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 30

Task 3: Matlab window output >> pop_loadset(): loading file /faces_4.set... eeg_checkset: recomputing the ICA activation matrix... Creating a new ALLEEG dataset 1 Done. Computing projection... Components removed eeg_checkset: recomputing the ICA activation matrix... Done. pop_epoch():364 epochs selected Epoching... pop_epoch():364 epochs generated eeg_checkset: recomputing the ICA activation matrix... pop_epoch(): checking epochs for data discontinuity Done. pop_rmbase(): Removing baseline... eeg_checkset: recomputing the ICA activation matrix... Done. Removing 182 trial(s)... Pop_select: removing 359 unreferenced events Creating a new ALLEEG dataset 2 Done. Removing 182 trial(s)... Pop_select: removing 366 unreferenced events Creating a new ALLEEG dataset 3 Done. eegh EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 31

Task 3: eegh history output >> eegh [ALLEEG EEG CURRENTSET ALLCOM] = eeglab; EEG = pop_loadset( 'filename', 'faces_4.set', 'filepath', ' \data\'); [ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 0 ); EEG = pop_subcomp( EEG, [4], 0); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, 1, 'setname', 'faces_4 pruned with ICA', 'overwrite', 'on'); EEG = pop_epoch( EEG, { 'face' 'object' }, [-1 2], 'newname', 'faces_4 pruned with ICA epochs', 'epochinfo', 'yes'); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, 1, 'overwrite', 'on'); EEG = pop_rmbase( EEG, [-200 0]); [ALLEEG EEG] = eeg_store(alleeg, EEG, CURRENTSET); EEG = pop_selectevent( EEG, 'type',{ 'face'}, 'deleteevents','off', 'deleteepochs', 'on'); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, 1, 'setname', 'faces only epochs'); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, 2, 'retrieve',1, 'study',0); EEG = pop_selectevent( EEG, 'type',{ 'object'}, 'deleteevents', 'off', 'deleteepochs', 'on'); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, 1, 'setname', 'object only epochs'); EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 32

Task 3: Create a script indata = 'faces_4.set'; % replace strings inpath = '...\data\'; % with variables % load data set EEG = pop_loadset( indata,inpath); [ALLEEG EEG CURRENTSET] = eeg_store(alleeg, EEG,1); % remove eye components for ERP plotting % (replace IC index with your new EEG field): EEG = pop_subcomp( EEG, EEG.blink, 0); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, 1, 'overwrite', 'on'); % Epoch the data (replace events with a variable) condition = {'object','face'}; EEG=pop_epoch( EEG,condition,[-0.2 0.8], 'epochinfo','yes'); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, 1, 'overwrite','on'); % still in ALLEEG(1) EEG = pop_rmbase( EEG, [-200 0]); [ALLEEG EEG] = eeg_store(alleeg, EEG, CURRENTSET); EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 33

Task 3: Create a script, cont'd % Create 'face'-only dataset EEG = pop_selectevent( EEG, 'type',{condition{1}}, 'deleteevents', 'off', 'deleteepochs', 'on'); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, 1, 'setname', condition{1}); % Retrieve original epoched dataset [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, 2, 'retrieve',1, 'study',0); % Create 'object'-only dataset EEG = pop_selectevent( EEG,'type',{condition{2}}, 'deleteevents', 'off', 'deleteepochs', 'on'); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, 1, 'setname', condition{2}); EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 34

Task 3: Loop across data sets % create datasets for each condition for i = 1:length(condition) EEG = pop_selectevent(eeg,'type',{condition{i}},... 'deleteevents','off','deleteepochs','on'); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, 1,... 'setname', condition{i}); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, i+1, 'retrieve',1, 'study',0); % Go back to ALLEEG(1) end % plot ERPs pop_comperp( ALLEEG, 1, [2 3],[],'addavg', 'off',... 'addstd','off', 'addall', 'on', 'diffavg','off',... 'diffstd','off', 'tplotopt',{'title',... 'Object vs Face ERPs', 'ydir', -1}); % save figure; print('-dtiff', [inpath,'erp.tif']); EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 35

Task 3: Loop across data sets Face vs Object ERPs EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 36

Exercise: Script it yourself % replace strings with variables indata = 'faces_4.set'; inpath = '...\data\'; condition = {'object','face'}; %-------------------------------------------------------------------- EEG = pop_loadset( indata,inpath); [ALLEEG EEG CURRENTSET] = eeg_store(alleeg, EEG); EEG = pop_subcomp( EEG, EEG.blink, 0); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg,eeg, 0, 'overwrite', 'on'); EEG=pop_epoch( EEG,{condition},[-0.2 0.8], 'epochinfo','yes'); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, 1,'overwrite','on'); EEG = pop_rmbase( EEG, [-200 0]); [ALLEEG EEG] = eeg_store(alleeg, EEG, CURRENTSET); for i = 1:length(condition) EEG = pop_selectevent(eeg,'type',{condition{i}},'deleteevents','off','deleteepochs','on'); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, 1,CURRENTSET, 'setname', condition{i}); [ALLEEG EEG CURRENTSET] = pop_newset(alleeg, EEG, i+1,'retrieve',1, 'study',0); end pop_comperp( ALLEEG, 1, [2 3],[],'addavg', 'off',... 'addstd','off', 'addall', 'on', 'diffavg','off',... 'diffstd','off', 'tplotopt',{'title',... 'Object vs Face ERPs', 'ydir', -1}); print('-dtiff', [inpath,'erp.tif']); For reference: example script saved as: ' \EEGLAB workshop\scripts\practicum_4.m' EEGLAB Workshop III, Nov. 15-18, 2006, Singapore: Julie Onton Using EEGLAB history for basic scripting 37