Hi,
I’ve built an experiment and have been having a hard time as to how to save the data as correct/incorrect. The experiment essentially is as follows:
The participant has a choice of 3 images to click on. Only 1 is correct and the other 2 are incorrect. When going to the excel file, I can see whether the participant has chosen the target image or foil images. However, I want it to save each trial as ‘correct’ or ‘incorrect’ on the excel file. I know there’s code required, but anything I use doesn’t work.
Thank you.
Put a column in your conditions file that contains the name of the correct stimulus component (e.g. image
, image_2
, target
, foil
, etc, whatever you have named them in the Builder interface). Let’s say that column is labelled correct_stimulus
. Then insert a code component (from the “custom” component panel). In its “end routine” tab, put something like this:
thisExp.addData('correct', correct_stimulus in mouse.clicked_name)
i.e. this will record True
if the clicked stimulus has the right name, False
otherwise. Replace mouse
with whatever the name of your Mouse component is.