<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi Daniela,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">What's the error message that matlab gives you?</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Best,</p>
<p style="margin-top:0;margin-bottom:0">Tom<br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> fieldtrip <fieldtrip-bounces@science.ru.nl> on behalf of Mejia, Daniela <mejia6@illinois.edu><br>
<b>Sent:</b> 09 August 2018 13:29:28<br>
<b>To:</b> FieldTrip discussion list<br>
<b>Subject:</b> Re: [FieldTrip] converting eeglab to fieldtrip for time-frequency analysis</font>
<div> </div>
</div>
<meta content="text/html; charset=Windows-1252">
<style type="text/css" id="owaParaStyle">
<!--
p
        {margin-top:0;
        margin-bottom:0}
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div class="" style="word-wrap:break-word">
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">
<div>Hello,</div>
<div><br>
</div>
<div>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>
</div>
<div><br>
</div>
<div>Thank you,</div>
<div>Daniela<br>
</div>
<div style="font-family:Times New Roman; color:#000000; font-size:16px">
<hr tabindex="-1">
<div id="x_divRpF67418" 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 2:37 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>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="" rel="noopener noreferrer" target="_blank">mejia6@illinois.edu</a>> wrote:</div>
<br class="x_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="x_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="x_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="x_Apple-converted-space"> </span><font class="" size="2">this:<span class="x_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="x_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" target="_blank" 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">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" target="_blank" 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">https://doi.org/10.1371/journal.pcbi.1002202</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
</div>
</body>
</html>