<div dir="auto"><div>Hi Duru,</div><div dir="auto"><br></div><div dir="auto">Use cfg.trials = trial_index</div><div dir="auto">Put the output in a struct, i.e. bl{trial_index}</div><div dir="auto">Then combine with ft_append_data([],bl{:});</div><div dir="auto"><br></div><div dir="auto">Hope this helps,</div><div dir="auto">Stephen</div><div dir="auto"><br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Tue, 17 Sep 2019, 19:30 Duru Gun Ozkan, <<a href="mailto:durugun.ozkan@uniroma1.it">durugun.ozkan@uniroma1.it</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi everyone,<div><br></div><div>I have a question regarding specifying a different baseline correction time for each trial in ft_preprocessing.</div><div>I had 360 audio stimuli all of which had different lengths. My trigger is located at the end of each stimuli, and I would like to place the baseline correction between 200 ms before stimulus start and stimulus start.</div><div>I have a matrix for cfg.baselinewindow called BaselineWindow such as this:</div><div><table border="0" cellpadding="0" cellspacing="0" width="151" style="border-collapse:collapse;width:113pt">
<colgroup><col width="64" style="width:48pt">
<col width="87" style="width:65pt">
</colgroup><tbody><tr height="20" style="height:15pt">
<td height="20" align="right" width="64" style="height:15pt;width:48pt;padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-1.83018</td>
<td align="right" width="87" style="width:65pt;padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-1.630182</td>
</tr>
<tr height="20" style="height:15pt">
<td height="20" align="right" style="height:15pt;padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-1.69807</td>
<td align="right" style="padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-1.498071</td>
</tr>
<tr height="20" style="height:15pt">
<td height="20" align="right" style="height:15pt;padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-0.58653</td>
<td align="right" style="padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-0.38653</td>
</tr>
<tr height="20" style="height:15pt">
<td height="20" align="right" style="height:15pt;padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-1.07604</td>
<td align="right" style="padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-0.876039</td>
</tr>
<tr height="20" style="height:15pt">
<td height="20" align="right" style="height:15pt;padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-2.2608</td>
<td align="right" style="padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-2.060803</td>
</tr>
<tr height="20" style="height:15pt">
<td height="20" align="right" style="height:15pt;padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-0.80863</td>
<td align="right" style="padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-0.608632</td>
</tr>
<tr height="20" style="height:15pt">
<td height="20" align="right" style="height:15pt;padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-1.55663</td>
<td align="right" style="padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-1.356629</td>
</tr>
<tr height="20" style="height:15pt">
<td height="20" align="right" style="height:15pt;padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-0.94261</td>
<td align="right" style="padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-0.742605</td>
</tr>
<tr height="20" style="height:15pt">
<td height="20" align="right" style="height:15pt;padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-1.20845</td>
<td align="right" style="padding-top:1px;padding-right:1px;padding-left:1px;color:black;font-family:Calibri,sans-serif;vertical-align:bottom;border:none;white-space:nowrap">-1.008448</td>
</tr>
</tbody></table>... <br>I tried to create a loop:</div><div><br></div><div>for trial_index = 1:360<br> <br> cfg = [];<br> cfg.demean = 'yes';<br> cfg.baselinewindow = [BaselineWindow(trial_index,1) BaselineWindow(trial_index,2)];<br><br> data_baselined_end_E = ft_preprocessing(cfg, data_end_E);<br> <br> end </div><div><br></div><div>This didn't work because it kept running the preprocessing with all the baselines with all trials, instead of keeping to its specific trial.</div><div><br></div><div>My question is, is there another way to specify individual baselines for individual trials? Or can anyone suggest to improve this loop to have the data preprocessed with its specific baseline windows?</div><div><br></div><div>Thank you in advance.</div><div><br></div><div>Best,</div><div><br></div><div>Duru <br><div><br></div>-- <br><div dir="ltr" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><i style="font-size:12.8px">Duru G</i><span style="font-family:Calibri,sans-serif;font-size:14.6667px;text-align:justify"><i>ü</i></span><i style="font-size:12.8px">n </i><span style="font-family:Calibri,sans-serif;font-size:14.6667px;text-align:justify"><i>Ö</i></span><i style="font-size:12.8px">zkan</i><div style="font-size:12.8px"><span style="font-size:12.8px"><i><br></i></span></div><div><div style="font-size:12.8px;color:rgb(136,136,136)"><font size="1" face="trebuchet ms, sans-serif"><b>Ph.D. student in Cognitive Social and Affective Neuroscience.<br></b></font></div><div style="font-size:12.8px;color:rgb(136,136,136)"><font size="1" face="trebuchet ms, sans-serif"><b>Department of Psychology.<br>University of Rome "La Sapienza".<br>Via dei Marsi 78 - 00185 - Roma.</b></font></div><div style="font-size:12.8px;color:rgb(136,136,136)"><font size="1" face="trebuchet ms, sans-serif"><b> </b></font><b style="font-family:"trebuchet ms",sans-serif;font-size:x-small">e-mail: <a href="mailto:vanessa.era@uniroma1.it" style="color:rgb(17,85,204)" target="_blank" rel="noreferrer">durugun.ozkan@uniroma1.it</a></b></div><div><font color="#1155cc" size="1"><u><a href="https://agliotilab.org/lab-staff/phd-students/2nd-year#anchor" target="_blank" rel="noreferrer">https://agliotilab.org/lab-staff/phd-students/2nd-year#anchor</a></u></font><br></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer 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 noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote></div></div></div>