<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr">Hello Ioanna, <div><br></div><div>Because the ouput is in a 4D matrix it has to put zeros because you cannot "not have" something that fills all dimensions. Hence the zeros. </div><div><br></div><div>If having the zeros is inconvenient for you because you are doing single trial analysis, you may try to do a loop in which you call ft_freqanalysis with cfg.trials corresponding to one different trial each time. That will give a cell array of structure outputs that you can later merge into one structure with trials in different cells. But depending on what kind of stats or analysis you want to do later, the typical fieldtrip functions might not like this arrangement. </div><div><br></div><div>Also depending on the kind of experiment you are working on, if the entire duration of your trial is not need and you need to do grand averaging, you might want to consider truncating your trials at the lenght of the shortest trial.</div><div><br></div><div>Cheers, </div><div>Raphaël</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 26 juin 2019 à 11:28, Ioanna Zioga <<a href="mailto:i.zioga@qmul.ac.uk">i.zioga@qmul.ac.uk</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div id="gmail-m_-941415676428467196divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0px;margin-bottom:0px">Hello Fieldtrip community!</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">I want to do TFR analysis on datasets with trials with different lengths (as I'm analysing the time period from the onset of a stimulus until participant's response, which differs from trial to trial).</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">These are the parameters:</p>
<p style="margin-top:0px;margin-bottom:0px"></p>
<div>cfgft                   = [];</div>
<div>cfgft.method    = 'tfr';</div>
<div>cfgft.output      = 'pow';</div>
<div>cfgft.foi              = exp(linspace(log(2),log(45),50));</div>
<div><b>cfgft.toi              = [];</b></div>
<div>cfgft.width         = 6;</div>
<div>cfgft.keeptrials  = 'yes';</div>
<br>
<p></p>
<p style="margin-top:0px;margin-bottom:0px">The result I get from the freqanalysis (powspctrm) is a
<b>trial x chan x freq x time </b>matrix, in which the <b>time </b>is the time of the trial with the largest duration. The datapoints of the trials with smaller durations are filled with zeros.</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">I would prefer to get the powspctrm without the zeros at the end, but maybe I can just exclude them later on from the analysis?</p>
<p style="margin-top:0px;margin-bottom:0px">Do you know <span style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px">
if Fieldtrip works fine with trials of different durations? And </span>if there is any other more efficient way to analyse trials with different durations?</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">Any help would be extremely appreciated, t<span style="font-size:12pt">hanks so much in advance!</span></p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">Best wishes,</p>
<p style="margin-top:0px;margin-bottom:0px">Ioanna</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
</div>
</div>

_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote></div>