<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Songhee,
<div class=""><br class="">
</div>
<div class="">In order to investigate this mystery a bit, I suggest that you use the MATLAB debugger <a href="https://www.section.io/engineering-education/how-to-debug-matlab-code/" class="">https://www.section.io/engineering-education/how-to-debug-matlab-code/</a> to
 put some breakpoints in the relevant section of ft_timelockbaseline so that you can inspect what happens in the code using the 3 different use cases you sketch.</div>
<div class=""><br class="">
</div>
<div class="">This will give you some directions as to how to change the code (i.e. build in some checks with respect to the requested times in the cfg.baseline in relation to the time axis in your data object, and throw an appropriate warning/error if needed).
 Feel free to send these updates as a Pull Request <a href="https://www.fieldtriptoolbox.org/development/git/" class="">https://www.fieldtriptoolbox.org/development/git/</a> on github.</div>
<div class=""><br class="">
</div>
<div class="">Happy code snooping and keep up the good work,</div>
<div class=""><br class="">
</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 25 May 2022, at 21:19, Songhee Kim via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
Hi FieldTrippers, </div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
<br class="">
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
I am curious to know how cfg.baseline exactly works in ft_timelockbaseline. I have a time-locked data (i.e., datain), whose 'time' goes from -1 to 2. Now, I tried running ft_timelockbaseline with the following baseline parameters:</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
<br class="">
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
cfg.baseline = [-0.5 0]         intended baseline</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
cfg.baseline = [-3 -2]           should throw an error</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
cfg.baseline = [1 0]             should thrown an error I believe </div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
<br class="">
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
But none of this threw an error. When I inspected dataout, it seems that dataout.avg is identical to datain.avg in the case of cfg.baseline = [1 0]. But in other cases, they are not identical, meaning ft_timelockbaseline() did something. My code example is
 below:</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
<br class="">
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
cfg=[];<br class="">
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
datain = ft_timelockanalysis(cfg, data);<br class="">
cfg= []; cfg.baseline = [-0.5, 0];<br class="">
dataout  = ft_timelockbaseline(cfg, datain); <br class="">
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
<br class="">
</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
Thanks,</div>
-- <br class="">
<div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div style="font-size: 12.8px;" class=""><font color="#676767" class=""><b class="">Songhee Kim, PhD</b><br class="">
</font></div>
<div style="font-size:12.8px" class=""><font color="#676767" class="">Postdoctoral Fellow</font></div>
<div style="font-size:12.8px" class=""><font color="#676767" class="">Department of Neurology</font></div>
<div style="font-size: 12.8px;" class="">Medical College of Wisconsin</div>
<div style="font-size: 12.8px;" class=""></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!62h6YNGqtasv45u5LwdiOCKrqKIdNlpXz6BRoCAGTmkbnesHD6cMqeUETw_cHm4EZuRuNevy_KwJjls9488HoxSoyZACYYx7zMwPLQ$
<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>