<div dir="ltr">Hi, Rachel<div><br></div><div>Probably because cfg.begsample and cfg.endsample should be sample points of the begin and the end of the trails instead of the time;</div><div><br></div><div>I am not sure;</div><div><br></div><div>Regards,</div><div>Rui.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 28, 2016 at 3:43 PM, Nakyung Lee <span dir="ltr"><<a href="mailto:rleese12@berkeley.edu" target="_blank">rleese12@berkeley.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span style="font-size:12.8px">Dear FieldTrip community,</span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">I've been having a problem calling 'ft_redefinetrial'.</span></div><div><span style="font-size:12.8px">Basically with my raw data with one trial (simply '<font color="#000000" face="monospace, monospace">data</font>' here), I've been trying to segment that one trial into smaller trials (so I can get rid of '<font color="#000000" face="monospace, monospace">bad_times</font>') by using the following code:</span></div><div><font color="#000000" face="monospace, monospace"><br></font></div><div><font color="#000000" face="monospace, monospace">time = data.time{1,1};</font></div><div><font color="#000000" face="monospace, monospace">bad_times = globals.bad_times_sorted; </font><font color="#000000" face="monospace, monospace">%</font><span style="color:rgb(0,0,0);font-family:monospace,monospace"> a N*2 sorted double</span></div><div><font color="#000000" face="monospace, monospace"><br></font></div><div><font color="#000000" face="monospace, monospace">cfg.begsample = [time(1); bad_times(:,2) + 1];</font></div><div><font color="#000000" face="monospace, monospace">cfg.endsample = [bad_times(:,1) - 1; time(end)];</font></div><div><font color="#000000" face="monospace, monospace"><br></font></div><div><font color="#000000" face="monospace, monospace">data_good = ft_redefinetrial(cfg, data);</font></div><div><font color="#3d85c6"><br></font></div><div><font color="#000000">However the code returns a data with only one trial.</font></div><div><font color="#000000">(i.e. the resulting data_good consists of only one trial which correspond to the time (<font face="monospace, monospace">time(1) : bad_times(1,1)</font>.)</font></div><div><font color="#000000">The code is very simple and I didn't really expect it to behave this way.</font></div><div><font color="#000000">Does anyone see why this is happening?</font></div><div><font color="#000000">Any type of help would be appreciated.</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">Best regards,</font></div><div><font color="#000000">Rachel Lee</font></div><div><br></div></div>
<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><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></blockquote></div><br></div>