%% preparations % set working directory cd('/scr/mirabelle1/schimanski_eeg/') path = '/scr/mirabelle1/schimanski_eeg/vp'; % select participants subj= { '01' '02' '03' '04' '05' '06' '07' '08' '10' '11' '12' '13' '14' '15' '16' '17' '19' '20' '21' '22' '24' '25' '26'}; % define events conds{1} = { 'S110' }; conds{2} = { 'S111' }; conds{3} = { 'S112' }; conds{4} = { 'S113' }; conds{5} = { 'S120' }; conds{6} = { 'S121' }; conds{7} = { 'S122' }; conds{8} = { 'S123' }; conds{9} = { 'S210' }; conds{10} = { 'S211' }; conds{11} = { 'S212' }; conds{12} = { 'S213' }; conds{13} = { 'S220' }; conds{14} = { 'S221' }; conds{15} = { 'S222' }; conds{16} = { 'S223' }; %% first loop for data I/O and visual rejection after rereferencing and filtering. % do for all participants for s = 1 : length(subj) %% read data cfg = []; cfg.dataset = [ path subj{s} '/vp' subj{s} '.eeg' ]; data_org = preprocessing(cfg); %% merge EOG channels % EOGV cfg = []; cfg.channel = {'V+' 'V_'}; cfg.reref = 'yes'; cfg.implicitref = []; cfg.refchannel = {'V+'}; eogv = preprocessing(cfg,data_org); eogv.label = {'dummy2', 'eogv'}; cfg = []; cfg.channel = 'eogv'; eogv = preprocessing(cfg,eogv); % EOGH cfg = []; cfg.channel = {'H+' 'H_'}; cfg.reref = 'yes'; cfg.implicitref = []; cfg.refchannel = {'H+'}; eogh = preprocessing(cfg, data_org); eogh.label = {'dummy1', 'eogh'}; cfg = []; cfg.channel = 'eogh'; eogh = preprocessing(cfg,eogh); % add EOG to data cfg = []; data_with_eog = appenddata(cfg, data_org, eogh, eogv); %% re-reference to average cfg = []; cfg.reref = 'yes'; cfg.refchannel = data_with_eog.label; data = preprocessing(cfg,data_with_eog); %% filter cfg = []; cfg.hpfilter = 'yes'; cfg.hpfreq = .05; %cfg.lpfilter = 'yes'; %cfg.lpfreq = 20; data_with_eog = preprocessing(cfg,data); %% epoching cfg = []; cfg.dataset = [ path subj{s} '/vp' subj{s} '.eeg' ]; cfg.trialdef.eventtype = 'Stimulus'; cfg.trialdef.eventvalue = conds{c}; cfg.trialdef.prestim = 1; cfg.trialdef.poststim = 2; cfg = definetrial(cfg); data = redefinetrial(cfg,data_with_eog); trl = cfg.trl; trl([1 end],:) = []; % do for all conditions for c = 1 : length(conds) %% automatic rejection % EOG cfg = []; cfg.trl = trl; cfg.continuous = 'no'; cfg.artfctdef.eog.bpfilter = 'yes'; cfg.artfctdef.eog.bpfilttype = 'but'; cfg.artfctdef.eog.bpfreq = [1 15]; cfg.artfctdef.eog.bpfiltord = 4; cfg.artfctdef.eog.hilbert = 'yes'; cfg.artfctdef.eog.feedback = 'no'; cfg.artfctdef.eog.channel = { 'eogv' , 'eogh' }; cfg.artfctdef.eog.cutoff = 4; cfg.artfctdef.reject = 'complete'; cfg = artifact_eog(cfg,data); %% save save([ path '/SCR/schimanski_eeg/avr/' subj{s} '_cond_' num2str(c) '.mat'], 'cfg'); end end ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.