<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi Daniela,
<div class=""><br class="">
</div>
<div class="">I am afraid that it’s not clear to the readers of this list whether and what is going wrong, because you don’t write about it.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div>
<blockquote type="cite" class="">
<div class="">On 9 Aug 2018, at 01:24, Mejia, Daniela <<a href="mailto:mejia6@illinois.edu" class="">mejia6@illinois.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; direction: ltr; font-family: Tahoma; font-size: 10pt;" class="">
Hello,<br class="">
<div style="margin-top: 0px; margin-bottom: 0px;" class="">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 class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">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.</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">My code and a sample dataset can be found here:<span class="Apple-converted-space"> </span><a href="https://uofi.box.com/s/cxbuqqhp065wenpzw1bxasr5vpcdvlms" target="_blank" class="">https://uofi.box.com/s/cxbuqqhp065wenpzw1bxasr5vpcdvlms</a><span class="Apple-converted-space"> </span><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">also here's the gist of it:</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><font face="Courier New" class="">%define trial<br class="">
 cfg = [];<br class="">
 cfg.dataset            = '/Users/Daniela/Desktop/aim_set/TF/aim345_ep_ad3rej.set';<br class="">
 cfg.trialdef.eventtype = 'trigger';<br class="">
 cfg.trialdef.eventvalue = {'B1(1)','B2(2)','B3(3)','B4(4)'};<br class="">
 cfg = ft_definetrial(cfg);<br class="">
<br class="">
% preprocess the data<br class="">
data = eeglab2fieldtrip(EEG,'preprocessing','none');<br class="">
<br class="">
cfg_pre=[];<br class="">
cfg_pre.channel={'all','-A2'};<br class="">
cfg_pre.demean='yes';<br class="">
cfg_pre.baselinewindow ='all'; % or [begin end]<br class="">
cfg_pre.trials = 'all';<br class="">
<br class="">
tpt0_id=find_tpt(EEG.times,0);<br class="">
<br class="">
%add a trial configuration to make sure fieldtrip<br class="">
%doesn't think the data are really continuous<br class="">
for a=1:n_trials,<br class="">
    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 class="">
    %get rid of possible time numerical error; milliseconds is the<br class="">
    %lowest resolution we should ever need<br class="">
    data.time{a}=round(data.time{a}*1000)/1000;<br class="">
end<br class="">
<br class="">
ft_data=ft_preprocessing(cfg_pre,data);</font><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">The find_tpt function is based on<span class="Apple-converted-space"> </span><font size="2" class="">this:<span class="Apple-converted-space"> </span></font><font face="Courier New" class=""><font size="2" face="Tahoma" class=""><a href="http://kutaslab.ucsd.edu/matlabmk_fn_docs/matlabmk/find_tpt.html" target="_blank" class="">http://kutaslab.ucsd.edu/matlabmk_fn_docs/matlabmk/find_tpt.html</a></font><span class="Apple-converted-space"> </span><br class="">
</font></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">Any suggestions on what I am doing wrong would be greatly appreciated! Thank you.<br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">Best,</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">Daniela Mejía<br class="">
</div>
</div>
<span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">fieldtrip
 mailing list</span><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://doi.org/10.1371/journal.pcbi.1002202</a></div>
</blockquote>
</div>
<br class="">
</body>
</html>