<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hello,<br>
<p>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.<br>
</p>
<p><br>
</p>
<p>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.</p>
<p><br>
</p>
<p>My code and a sample dataset can be found here: <a href="https://uofi.box.com/s/cxbuqqhp065wenpzw1bxasr5vpcdvlms" target="_blank">
https://uofi.box.com/s/cxbuqqhp065wenpzw1bxasr5vpcdvlms</a> <br>
</p>
<p>also here's the gist of it:</p>
<p><br>
</p>
<p><font face="Courier New">%define trial<br>
 cfg = [];<br>
 cfg.dataset            = '/Users/Daniela/Desktop/aim_set/TF/aim345_ep_ad3rej.set';<br>
 cfg.trialdef.eventtype = 'trigger';<br>
 cfg.trialdef.eventvalue = {'B1(1)','B2(2)','B3(3)','B4(4)'};<br>
 cfg = ft_definetrial(cfg);<br>
<br>
% preprocess the data<br>
data = eeglab2fieldtrip(EEG,'preprocessing','none');<br>
<br>
cfg_pre=[];<br>
cfg_pre.channel={'all','-A2'};<br>
cfg_pre.demean='yes';<br>
cfg_pre.baselinewindow ='all'; % or [begin end]<br>
cfg_pre.trials = 'all';<br>
<br>
tpt0_id=find_tpt(EEG.times,0);<br>
<br>
%add a trial configuration to make sure fieldtrip<br>
%doesn't think the data are really continuous<br>
for a=1:n_trials,<br>
    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.<br>
    %get rid of possible time numerical error; milliseconds is the<br>
    %lowest resolution we should ever need<br>
    data.time{a}=round(data.time{a}*1000)/1000;<br>
end<br>
<br>
ft_data=ft_preprocessing(cfg_pre,data);</font><br>
</p>
<p><br>
</p>
<p>The find_tpt function is based on <font size="2">this: </font><font face="Courier New"><font size="2" face="Tahoma"><a href="http://kutaslab.ucsd.edu/matlabmk_fn_docs/matlabmk/find_tpt.html" target="_blank">http://kutaslab.ucsd.edu/matlabmk_fn_docs/matlabmk/find_tpt.html</a></font>
<br>
</font></p>
<p><br>
</p>
<p>Any suggestions on what I am doing wrong would be greatly appreciated! Thank you.<br>
</p>
<p><br>
</p>
<p>Best, </p>
<p>Daniela Mejía<br>
</p>
</div>
</body>
</html>