Scripting using ERPLAB

Here is an example of a script using EEGLAB/ERPLAB functions.

 

 

 

 


% This script loads a bunch of *.cnt file from Neuroscan,

% and finalizes creating bin-based epoched dataset, ready for averaging

% using ERPLAB.

subject = {'Debo', 'Diego', 'Felix', 'Guenia', 'JavieraS', 'Javy',...

    'Lilian', 'Male', 'Marcela', 'Panchi', 'Pipe', 'TeresaP', 'Vale',...

    'Villouta', 'Ximena'};

 

pathname_read  = 'C:\Mov_Cross\';

pathname_write = 'C:\Mov_Cross\';

nsubj = length(subject);

 

%

% Loads .cnt files for each subject, and saves them.

for s=1:nsubj

    fprintf('Processing Subject #%g : %s...\n', s, subject{s})

    EEG = pop_loadcnt([pathname_read subject{s} '_MovCross.cnt'], 'dataformat', 'int32');

    EEG.setname= [subject{s} '_MovCross'];

    EEG = pop_saveset( EEG,  'filename', [subject{s} '_MovCross.set'], 'filepath', pathname_write);

    EEG = eeg_checkset( EEG );

end

for s=1:nsubj

    EEG = pop_loadset( 'filename', [subject{s} '_MovCross.set'], 'filepath', pathname_read);

    %

    % low pass filter, eeglab

    EEG = pop_eegfilt( EEG, 0, 40, 2, 0);

    %

    % creates new channels, erplab

    EEG = pop_chanoperator( EEG, {  'ch41 = ch2-ch1 label HEOG'  'ch42 = ch6-ch5 label VEOG'  });

    %

    % creates binlist, erplab

    EEG = pop_binlister( EEG, 'C:\Mov_Cross\BDF_Mov_alitas.txt', 'no', ['C:\Mov_Cross\' subject{s} '_BinList_simple.txt']);

    %

    % converts numeric eventcodes into bin-labels, erplab

    EEG = pop_code2bin( EEG, 0);

    %

    % extracts bin-based epoch, erplab & eeglab

    EEG = erp_epochbin( EEG, [-0.2 0.3] );

    %

    % performs moving window peak-to-peak voltage threshold AR (full

    % window), erplab

    EEG = erp_artmwppth( EEG, [-0.2 0.299], 100, 500, 20,  1:42, 0);

    %

    % performs blink detection over new channel (42), erplab

    EEG = erp_artblink( EEG, [-0.2 0.299], 0.4, 0.7,  42, 0);

    %

    % performs horiz eye mov detection over new channel (41), erplab

    EEG = erp_artbarb( EEG, [-0.2 0.299], 0.5,  41, 0);

    %

    % Saves work, eeglab. bin-based epoched data

    EEG = pop_saveset( EEG,  'filename', ['DIC02_' subject{s} '_MovCross_bepoch.set'], 'filepath', pathname_write);

    EEG = eeg_checkset( EEG );

<<Previous Section           Next Section >>


Back to Table of Contents