<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="">
Hi Bence,
<div class=""><br class="">
</div>
<div class="">I assume that you have found this page: <a href="https://urldefense.com/v3/__https://www.fieldtriptoolbox.org/example/making_your_own_trialfun_for_conditional_trial_definition/?__;!!HJOPV4FYYWzcc1jazlU!99VauwbX_G12mkgHlym3lIlBO0u0lXP1aUJVu4-KHcwhfGYyjIl07dObmYVpLFhYhK-8REa9Ci8jZ1V5j4NSGCJbwjubsjd1xppvTw$" class="">https://www.fieldtriptoolbox.org/example/making_your_own_trialfun_for_conditional_trial_definition/?</a></div>
<div class=""><br class="">
</div>
<div class="">I am not so sure what pointers can be given beyond the referenced page to get you up and running. In other words, it’s unclear to us why an adjusted version of the suggested code is not working for you. Perhaps there are additional events in between
the start and stop events, in which case you don’t need to evaluate each consecutive pair of events (as is done on the webpage), but you would need to build in a ‘while loop’ after the detection of each ’11’ or ’21’ until you hit the corresponding ’12’ and
’22’. Note that a while loop can get stuck, so you probably want to build in an escape possibility.</div>
<div class=""><br class="">
</div>
<div class="">Good luck</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 1 Mar 2023, at 19:29, Bence Szaszkó 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 class="">Hello Fieldtrippers,<br class="">
<br class="">
I am trying to segment my dataset into two datasets, based on conditions.<br class="">
I will simplify my example a bit here:<br class="">
Within the file, the start of condition A is marked with event 11 and it's end by event 12. The start of condition B is marked by event 21, while it's end by 22. Unfortunately, we're not talking about trials with a fixed amount of length, so their length is
only defined by the events themselves and varies greatly.<br class="">
<br class="">
My end product would be one dataset for all trials of condition A "stuck together", and one for condition B. Then, I would epoch the separated files in 2s epochs. However, I am not able to define my "trials" properly as a first step, neither by using an own
trial function, nor by using the default trial function. Do you have any idea how to approach this?<br class="">
<br class="">
Best regards,<br class="">
Bence<br class="">
<br class="">
-- <br class="">
Bence Szaszkó, BSc MA MSc<br class="">
University Assistant (prae doc)<br class="">
<br class="">
University of Vienna<br class="">
Faculty of Psychology<br class="">
Department of Cognition, Emotion, and Methods in Psychology<br class="">
<br class="">
Liebiggasse 5<br class="">
A-1010 Wien/Vienna<br class="">
Austria<br class="">
<br class="">
<a href="mailto:bence.szaszko@univie.ac.at" class="">e-mail: bence.szaszko@univie.ac.at</a><br class="">
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<br class="">
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!8uOylSRG7dJerANI9ZM0efoZO7OWea3gBUy7GTlaBR4lBxpEaYgbyxy87J69X3rCDGZYSvZNUUNuop8tXUx_1xlEWuzrVhTn-lhQDg$
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>