<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" id="owaParaStyle">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body class="" style="word-wrap:break-word" fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div>Okay, great. Thanks a lot.</div>
<div><br>
</div>
<div>Daniela<br>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF40348" style="direction: ltr;"><font size="2" face="Tahoma" color="#000000"><b>From:</b> fieldtrip [fieldtrip-bounces@science.ru.nl] on behalf of Schoffelen, J.M. (Jan Mathijs) [jan.schoffelen@donders.ru.nl]<br>
<b>Sent:</b> Thursday, August 09, 2018 7:44 AM<br>
<b>To:</b> FieldTrip discussion list<br>
<b>Subject:</b> Re: [FieldTrip] converting eeglab to fieldtrip for time-frequency analysis<br>
</font><br>
</div>
<div></div>
<div>What I meant is: do you get an error, or what? The code itself looks great, and is a pleasure to read, but so is a Shakespeare sonnet, or a musical score of a random JS Bach piece. Please refer to
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.fieldtriptoolbox.org_faq_how-5Fto-5Fask-5Fgood-5Fquestions-5Fto-5Fthe-5Fcommunity&d=DwMGaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=KrncpoJpT_EutbMQldPx5-SJFLw9BUIxd3rEtto-Deg&m=PYwu83wjaIOXV9TOxvwCkQ7E08QDsDZ5DslEORcvM58&s=kEtudKF7L68GsmKd_hX4UKzQ5inkxiFju9mCQwWTbrk&e=" class="" target="_blank" rel="noopener noreferrer">
http://www.fieldtriptoolbox.org/faq/how_to_ask_good_questions_to_the_community</a> and
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__journals.plos.org_ploscompbiol_article-3Fid-3D10.1371_journal.pcbi.1002202&d=DwMGaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=KrncpoJpT_EutbMQldPx5-SJFLw9BUIxd3rEtto-Deg&m=PYwu83wjaIOXV9TOxvwCkQ7E08QDsDZ5DslEORcvM58&s=-GigeHJBxbfqv65TOMkfOOHYwVgj2ShY6DIEw9Me52U&e=" class="" target="_blank" rel="noopener noreferrer">
http://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1002202</a> in  crafting your questions to this list.
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 9 Aug 2018, at 14:29, Mejia, Daniela <<a href="mailto:mejia6@illinois.edu" class="" target="_blank" rel="noopener noreferrer">mejia6@illinois.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; direction:ltr; font-family:Tahoma; font-size:10pt">
<div class="" style="direction:ltr; font-family:Tahoma; font-size:10pt">
<div class="">Hello,</div>
<div class=""><br class="">
</div>
<div class="">Thanks for the reply. Specifically I am trying to start with code that can at least produce a time frequency plot using Fieldtrip from a '.set' file that is already preprocessed in EEGLAB. I am not exactly sure where my code is wrong although
 my guess would be I am either defining the trials incorrectly or using ft_preprocessing wrong. From the code snippet that I provided, I would appreciate any feedback in case anything looks glaringly wrong or any suggestions.<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Thank you,</div>
<div class="">Daniela<br class="">
</div>
<div class="" style="font-family:'Times New Roman'; font-size:16px">
<hr tabindex="-1" class="">
<div id="divRpF67418" class="" style="direction:ltr"><font class="" size="2" face="Tahoma"><b class="">From:</b><span class="Apple-converted-space"> </span>fieldtrip [<a href="mailto:fieldtrip-bounces@science.ru.nl" class="" target="_blank" rel="noopener noreferrer">fieldtrip-bounces@science.ru.nl</a>]
 on behalf of Schoffelen, J.M. (Jan Mathijs) [<a href="mailto:jan.schoffelen@donders.ru.nl" class="" target="_blank" rel="noopener noreferrer">jan.schoffelen@donders.ru.nl</a>]<br class="">
<b class="">Sent:</b><span class="Apple-converted-space"> </span>Thursday, August 09, 2018 2:37 AM<br class="">
<b class="">To:</b><span class="Apple-converted-space"> </span>FieldTrip discussion list<br class="">
<b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: [FieldTrip] converting eeglab to fieldtrip for time-frequency analysis<br class="">
</font><br class="">
</div>
<div class=""></div>
<div 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 class="">
<blockquote type="cite" class="">
<div class="">On 9 Aug 2018, at 01:24, Mejia, Daniela <<a href="mailto:mejia6@illinois.edu" class="" rel="noopener noreferrer" target="_blank">mejia6@illinois.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; direction:ltr; font-family:Tahoma; font-size:10pt">
Hello,<br class="">
<div class="" style="margin-top:0px; margin-bottom:0px">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 class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">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 class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">My code and a sample dataset can be found here:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__uofi.box.com_s_cxbuqqhp065wenpzw1bxasr5vpcdvlms&d=DwMGaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=KrncpoJpT_EutbMQldPx5-SJFLw9BUIxd3rEtto-Deg&m=9btMdsT-0IgbyAR4ZOQUmoVq7FQ9trJ_xU5X_Wjy0Ys&s=cbhIljOK4jGLoHzHkyHFkEJXu1HeSn7VYDsptmYnnRE&e=" class="" rel="noopener noreferrer" target="_blank">https://uofi.box.com/s/cxbuqqhp065wenpzw1bxasr5vpcdvlms</a><span class="Apple-converted-space"> </span><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">also here's the gist of it:</div>
<div class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px"><font class="" face="Courier New">%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 class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">The find_tpt function is based on<span class="Apple-converted-space"> </span><font class="" size="2">this:<span class="Apple-converted-space"> </span></font><font class="" face="Courier New"><font class="" size="2" face="Tahoma"><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__kutaslab.ucsd.edu_matlabmk-5Ffn-5Fdocs_matlabmk_find-5Ftpt.html&d=DwMGaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=KrncpoJpT_EutbMQldPx5-SJFLw9BUIxd3rEtto-Deg&m=9btMdsT-0IgbyAR4ZOQUmoVq7FQ9trJ_xU5X_Wjy0Ys&s=q3HHwwwnDDnW60Oho80i1LvYHp2OycuZ5IijvIWfSZ4&e=" class="" rel="noopener noreferrer" target="_blank">http://kutaslab.ucsd.edu/matlabmk_fn_docs/matlabmk/find_tpt.html</a></font><span class="Apple-converted-space"> </span><br class="">
</font></div>
<div class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">Any suggestions on what I am doing wrong would be greatly appreciated! Thank you.<br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">Best,</div>
<div class="" style="margin-top:0px; margin-bottom:0px">Daniela Mejía<br class="">
</div>
</div>
<span class="" style="font-family:Helvetica; font-size:14px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; float:none; display:inline!important">_______________________________________________</span><br class="" style="font-family:Helvetica; font-size:14px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px">
<span class="" style="font-family:Helvetica; font-size:14px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; float:none; display:inline!important">fieldtrip
 mailing list</span><br class="" style="font-family:Helvetica; font-size:14px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px">
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__mailman.science.ru.nl_mailman_listinfo_fieldtrip&d=DwMGaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=KrncpoJpT_EutbMQldPx5-SJFLw9BUIxd3rEtto-Deg&m=9btMdsT-0IgbyAR4ZOQUmoVq7FQ9trJ_xU5X_Wjy0Ys&s=y5p1kW6yhzwZvki7HOHmC4urHidxaacGRSGNYnST9XE&e=" class="" rel="noopener noreferrer" style="font-family:Helvetica; font-size:14px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="" style="font-family:Helvetica; font-size:14px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px">
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__doi.org_10.1371_journal.pcbi.1002202&d=DwMGaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=KrncpoJpT_EutbMQldPx5-SJFLw9BUIxd3rEtto-Deg&m=9btMdsT-0IgbyAR4ZOQUmoVq7FQ9trJ_xU5X_Wjy0Ys&s=R_xrRpWFaansmT5V1MnSD641Dj2Iwm5oNf2q2kqRQbQ&e=" class="" rel="noopener noreferrer" style="font-family:Helvetica; font-size:14px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
<span class="" style="font-family:Helvetica; font-size:14px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; float:none; display:inline!important">_______________________________________________</span><br class="" style="font-family:Helvetica; font-size:14px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px">
<span class="" style="font-family:Helvetica; font-size:14px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; float:none; display:inline!important">fieldtrip
 mailing list</span><br class="" style="font-family:Helvetica; font-size:14px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px">
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__mailman.science.ru.nl_mailman_listinfo_fieldtrip&d=DwMGaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=KrncpoJpT_EutbMQldPx5-SJFLw9BUIxd3rEtto-Deg&m=PYwu83wjaIOXV9TOxvwCkQ7E08QDsDZ5DslEORcvM58&s=fJ0dRGwfNCo4dT_rQl7IuDcxtwNtv9kqCnbmUb7_t5U&e=" class="" style="font-family:Helvetica; font-size:14px; font-style: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" target="_blank" rel="noopener noreferrer">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="" style="font-family:Helvetica; font-size:14px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px">
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__doi.org_10.1371_journal.pcbi.1002202&d=DwMGaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=KrncpoJpT_EutbMQldPx5-SJFLw9BUIxd3rEtto-Deg&m=PYwu83wjaIOXV9TOxvwCkQ7E08QDsDZ5DslEORcvM58&s=z2Ghmy9KHM1EdIdRX_QjiIdLWXUJikTZDAyZe48I__8&e=" class="" style="font-family:Helvetica; font-size:14px; font-style: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" target="_blank" rel="noopener noreferrer">https://doi.org/10.1371/journal.pcbi.1002202</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
</body>
</html>