<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Dear Ioanna,
<div class=""><br class="">
</div>
<div class="">Yes, FieldTrip can work with trials of different duration. Normally, the missing data are represented as NaN, and not as a 0 (as it seems to be in your case). Many downstream functions know how to handle the missing data.</div>
<div class=""><br class="">
</div>
<div class="">Could you try and run ft_freqanalysis with cfg.method = ‘wavelet’, and check whether there are now NaNs, instead of 0’s? The method ’tfr’ is very slow and not recommended. Therefore, this code is not very actively maintained, so it could be that
 the 0’s are just a remnant of a distant past. If so, this should be changed. Perhaps (once you have verified that indeed ’tfr’ returns 0’s, where ‘wavelet’ returns NaNs) you could look into how the correct impelmentation should be, and post a suggested fix
 to the ’tfr’-code on github as a PR?</div>
<div class=""><br class="">
</div>
<div class="">Thanks in advance,</div>
<div class=""><br class="">
</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div>
<blockquote type="cite" class="">
<div class="">On 26 Jun 2019, at 11:12, Ioanna Zioga <<a href="mailto:i.zioga@qmul.ac.uk" class="">i.zioga@qmul.ac.uk</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div id="divtagdefaultwrapper" dir="ltr" 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; text-decoration: none; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class="">
<div style="margin-top: 0px; margin-bottom: 0px;" class="">Hello Fieldtrip community!</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">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).</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">These are the parameters:</div>
<p style="margin-top: 0px; margin-bottom: 0px;" class=""></p>
<div class="">cfgft                   = [];</div>
<div class="">cfgft.method    = 'tfr';</div>
<div class="">cfgft.output      = 'pow';</div>
<div class="">cfgft.foi              = exp(linspace(log(2),log(45),50));</div>
<div class=""><b class="">cfgft.toi              = [];</b></div>
<div class="">cfgft.width         = 6;</div>
<div class="">cfgft.keeptrials  = 'yes';</div>
<br class="">
<p style="margin-top: 0px; margin-bottom: 0px;" class=""></p>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">The result I get from the freqanalysis (powspctrm) is a<span class="Apple-converted-space"> </span><b class="">trial x chan x freq x time<span class="Apple-converted-space"> </span></b>matrix, in which
 the<span class="Apple-converted-space"> </span><b class="">time<span class="Apple-converted-space"> </span></b>is the time of the trial with the largest duration. The datapoints of the trials with smaller durations are filled with zeros.</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">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?</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">Do you know<span class="Apple-converted-space"> </span><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;" class="">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?</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">Any help would be extremely appreciated, t<span style="font-size: 12pt;" class="">hanks so much in advance!</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">Best wishes,</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class="">Ioanna</div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
</div>
<span style="caret-color: rgb(0, 0, 0); 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; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); 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; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); 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; text-decoration: none; float: none; display: inline !important;" class="">fieldtrip
 mailing list</span><br style="caret-color: rgb(0, 0, 0); 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; text-decoration: none;" 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="caret-color: rgb(0, 0, 0); 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; text-decoration: none;" 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="">
</div>
</body>
</html>