[FieldTrip] Variable trial length

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Thu Mar 2 08:02:47 CET 2023


Hi Bence,

I assume that you have found this page: https://urldefense.com/v3/__https://www.fieldtriptoolbox.org/example/making_your_own_trialfun_for_conditional_trial_definition/?__;!!HJOPV4FYYWzcc1jazlU!99VauwbX_G12mkgHlym3lIlBO0u0lXP1aUJVu4-KHcwhfGYyjIl07dObmYVpLFhYhK-8REa9Ci8jZ1V5j4NSGCJbwjubsjd1xppvTw$ 

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.

Good luck

Jan-Mathijs


On 1 Mar 2023, at 19:29, Bence Szaszkó via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hello Fieldtrippers,

I am trying to segment my dataset into two datasets, based on conditions.
I will simplify my example a bit here:
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.

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?

Best regards,
Bence

--
Bence Szaszkó, BSc MA MSc
University Assistant (prae doc)

University of Vienna
Faculty of Psychology
Department of Cognition, Emotion, and Methods in Psychology

Liebiggasse 5
A-1010 Wien/Vienna
Austria

e-mail: bence.szaszko at univie.ac.at<mailto:bence.szaszko at univie.ac.at>
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!8uOylSRG7dJerANI9ZM0efoZO7OWea3gBUy7GTlaBR4lBxpEaYgbyxy87J69X3rCDGZYSvZNUUNuop8tXUx_1xlEWuzrVhTn-lhQDg$

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230302/dc2fe811/attachment.htm>


More information about the fieldtrip mailing list