[Eeglablist] script example, to extract epochs?

Andrew Hill andrewhill at ucla.edu
Thu Jun 25 00:49:40 PDT 2009


several people have suggested solutions for this - thanks to everyone!
i'm still having issues understanding a few things in EEGLab  
scripting, and especially in memory management.

here is my script:

for S = [108 109];
     eeglab
     Cond =[ 'LVF_ConTarg_AllCue'; 'LVF_IncTarg_AllCue';  
'RVF_ConTarg_AllCue'; 'RVF_IncTarg_AllCue' ];
     trigs=[110 111 112 113; 120 121 122 123; 210 211 212 213; 220 221  
222 223 ];

    for c = 1:4;

     %load a file, for example 108.set, which is not filtered and uses  
common vertex reference.
     EEG = pop_loadset( 'filename', [int2str(S),'.set'], 'filepath', '/ 
Users/andrew/Documents/Research/DATA/stage/');
     [ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 0 );
     EEG = eeg_checkset( EEG );

     % re-reference to common average reference, excluding VEOU and VEOL
     EEG = pop_reref( EEG, [], 'refstate',0, 'exclude',[65 66] )

     % lookup Channel Locations
     EEG=pop_chanedit(EEG,  'lookup', '/Users/andrew/Documents/ 
Research/eeglab2008October01_beta/plugins/dipfit2.2/standard_BESA/ 
standard-10-5-cap385.elp');

     % EXTRACT EPOCHS, for trigs relevant to Cond
     EEG = pop_selectevent( EEG, 'event',trigs(c,:) , 'deleteepochs',  
'on');
     [ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 1, 'setname',  
Cond(c,:), 'savenew', [int2str(S),'_AVGREREF_',Cond(c,:)],  
'overwrite', 'on', 'gui', 'off');

     %baseline filter using pre-stimulus interval.
     %NOT working ->"pop_rmbase(): Wrong point range"
     %EEG = pop_rmbase( EEG, [-1000  0]);

     %maybe CLEAR some RAM? NOT working.
     %ALLEEG = pop_delset( ALLEEG, [1] );
     %CURRENTSET = pop_delset()
     end;
end;

so some strangeness:

1) when i save a new .set named per the S(ubject) and Cond(ition), the  
'deleteepochs', 'on'doesn't seem to work - the file contains ALL the  
epochs, not just 'trigs' ones specified./

2) the pop_rmbase syntax seems to be correct, from my eegh, but when  
put in a script it throws "pop_rmbase(): Wrong point range" . and  
including 'timerange' doesn't help.

3) the biggest problem is this script the second time around the loop,  
e.g. it only produces files for the first condition, first subject.

108_AVGREREF_LVF_ConTarg_AllCue.set
108_AVGREREF_LVF_ConTarg_AllCue.dat

and then fails with out of memory errors:
??? Error using ==> ctranspose
Out of memory. Type HELP MEMORY for your options.

i tried ALLEEG = pop_delset( ALLEEG, [1] ); to clear memory before  
running through the Condition loop a 2nd time, but this doesn't work.
what am i doing wrong? is there any better way to clear the memory  
before the next loop through?

thanks,
andrew

On Jun 18, 2009, at 4:56 PM, Andrew Hill wrote:

>
> does anyone have a simple example script, to open a .set file and
> extract a series of epochs by event types into different files?
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20090625/cedb5e73/attachment.html>


More information about the eeglablist mailing list