How to save trial responses to an array? #1441
Answered
by
becky-gilbert
chester108
asked this question in
Q&A
-
Hello. I have the following trial:
I would like to save participants' responses to the on_finish function as an array (either true or false based on their answer). How should I do this? Any help is greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Answered by
becky-gilbert
Feb 1, 2021
Replies: 1 comment 7 replies
-
Hi @chester108, is that what you're looking for? var response_accuracy = [];
var trial = {
type: 'image-keyboard-response',
stimulus: 'imgA.png',
on_finish: function(data) {
var acc;
if(data.key_press == 85){
acc = true;
} else {
acc = false;
}
data.correct = acc; // save response accuracy to the trial data
response_accuracy.push(acc); // add the response accuracy to the array
}
}; |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
becky-gilbert
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @chester108, is that what you're looking for?