Get trial/iteration number inside a timeline #2653
-
Hello jsPsych experts, I have a question that I think has a simple solution, but I can't seem to figure it out! I have an experiment where stimuli are displayed in a timeline using a timeline variable. In each trial I add certain information to the output data to be used during data analysis. Here, I want to add information about trial number, i.e., which iteration of the timeline variable is being currently implemented. How do I do this? Here's my timeline:
Quick note: I know that a column named trial_index is automatically added. But it seems to number every single event in the experimental timeline (including preloading, etc.). I want to only number the event where the stimulus is displayed. In the worst case I can change Thank you, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The following approach seems to work:
|
Beta Was this translation helpful? Give feedback.
The following approach seems to work:
trial_counter
variable.on_finish
function in which you increment the value of thetrial_counter
variable and add it to the trial data. I noticed that you need to use theon_finish
function. Simply adding it to the data key does not show an incremented value.