Millisecond Forums

How do I get the time of trial onset?

https://forums.millisecond.com/Topic16542.aspx

By july1810 - 6/17/2015

Hi,
I would like to write the time of the beginning of certain trials relative to the onset of a response in another trial into the data file. However, I cannot really think of a way how to do this. Could you help me? 
The background is that I would like to determine the onsets of my regressors during a fMRI experiment, but I do not see the timing of the trials, responses etc. relative to each other. 
Best
Julia

By Dave - 6/18/2015

You can read an applicable elapsedtime property /ontrialbegin, store it in a <values> entry and record that value to the data file and/or do other calculations based on it:

<values>
/ trialstart = 0
...
</values>

<trial mytrial>
/ ontrialbegin = [values.trialstart = script.elapsedtime; ]
...
</trial>

<data>
/ columns = [..., values.trialstart, ...]
...
</data>