| Reference | Downloads | Github

Response Collection, SDT, Keyboard

I am trying to estimate hits and misses rstes in a SDT study. How can I know which key was pressed and assign to excel sheet of experiment data? I am using the builder… Would appreciate any advice.

Thank you in Advance,

Hi calaf,

I suppose what you need is to call “.getKeys()” and then use “.addData()” to write it to your output file. The “.getKeys()” function will return a list with all the keypresses.

Add a code component and in the “end routine” write the following code. Make sure to match the name of your keyboard component.

thisExp.addData('key', keyboard.getKeys())

This will create a column in your csv file and store the list of pressed keys in the trial.

I hope it helps :slight_smile:

Thank you so much for explaining. Really appreciate it. It was definitely helpful.
Best Wishes,