-
Hi! I am using loop_function to achieve that everytime you press uparrow or downarrow, the image will change, and when you press space, the loop will be ended. The presentation works well, but I got trouble with the data writing. Basically, I'm not able to write data into the datafile. Here is the code:
At the end of this loop, i.e. when the subject presses space, I would like to store the current value "theang" into the data file. However, nothing apprears in the data file. I also tried to put 'data.respAng = theang;' in the above branches of if structure, where the condition leads to return true, also didn't work. If I put data in the on_finish parameter as for other normal trials, the trial will be ended when you press a key, i.e. no loop at all. Then I tried the on_timeline_finish, as this: I guess the loop_function does not allow writing data except those already stored in the data object created inside the loop? My question is how to write the properties that I'd like to store in my data file? Thanks so much if anyone has any idea how to achieve this, or provide more information about how the data object works inside the loop_function. Good day! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @Qiuishere,
Yes, that's correct. This is because the data returned from the loop function is the
I would recommend adding the on_finish: functon(data){
if(data.response == " "){
data.respAng = theang;
}
}
I'm guessing that what happened is that the |
Beta Was this translation helpful? Give feedback.
Hi @Qiuishere,
Yes, that's correct. This is because the data returned from the loop function is the
DataCollection
for all trials executed inside the loop. You could, I think, access individual trials within that collection and modify them.I would recommend adding the
on_finish
to theadjustment
trial.