[FieldTrip] converting eeglab to fieldtrip for time-frequency analysis
Mejia, Daniela
mejia6 at illinois.edu
Thu Aug 9 01:24:10 CEST 2018
Hello,
My name is Daniela Mejía and I am a student in the Cognitive Neuroimaging Lab at the University of Illinois. I have previously worked on time-frequency analysis of EEG data in EEGLAB and am currently trying to convert over to Fieldtrip for more advanced statistical testing.
I am aware of eeglab2fieldtrip and tried my best to write code based on previous mailinglist answers but I'm still not sure if I'm defining ft_preprocessing and/or ft_definetrials correctly.
My code and a sample dataset can be found here: https://uofi.box.com/s/cxbuqqhp065wenpzw1bxasr5vpcdvlms
also here's the gist of it:
%define trial
cfg = [];
cfg.dataset = '/Users/Daniela/Desktop/aim_set/TF/aim345_ep_ad3rej.set';
cfg.trialdef.eventtype = 'trigger';
cfg.trialdef.eventvalue = {'B1(1)','B2(2)','B3(3)','B4(4)'};
cfg = ft_definetrial(cfg);
% preprocess the data
data = eeglab2fieldtrip(EEG,'preprocessing','none');
cfg_pre=[];
cfg_pre.channel={'all','-A2'};
cfg_pre.demean='yes';
cfg_pre.baselinewindow ='all'; % or [begin end]
cfg_pre.trials = 'all';
tpt0_id=find_tpt(EEG.times,0);
%add a trial configuration to make sure fieldtrip
%doesn't think the data are really continuous
for a=1:n_trials,
data.cfg.trl(a,:)=[1 n_tpts tpt0_id a]; %"a" just tells you what EEG.epoch the trial corresponds to. It isn't used for anything now.
%get rid of possible time numerical error; milliseconds is the
%lowest resolution we should ever need
data.time{a}=round(data.time{a}*1000)/1000;
end
ft_data=ft_preprocessing(cfg_pre,data);
The find_tpt function is based on this: http://kutaslab.ucsd.edu/matlabmk_fn_docs/matlabmk/find_tpt.html
Any suggestions on what I am doing wrong would be greatly appreciated! Thank you.
Best,
Daniela Mejía
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20180808/14a2adca/attachment-0001.html>
More information about the fieldtrip
mailing list