Borrar filtros
Borrar filtros

Capture reaction time to specific button press

11 visualizaciones (últimos 30 días)
LG
LG el 17 de Mzo. de 2022
Respondida: LG el 18 de Mzo. de 2022
I would like to measure how long it takes a user to press key 1 after display of an instruction key. I've tried using tic toc but from manually checking elapsed time, I know that the variable 'reaction' is not capturing the data correctly. Are there any other ways I could do this other than tic toc? Thanks
one=KbName('1!');
Screen('DrawText',win,'Please press 1',100,100)
Screen('Flip',win)
tic;
while KbEventAvail;
[evt,n]=KbEventGet();
if evt.Keycode==one & evt.Pressed==1;
reaction=toc;
end
end

Respuesta aceptada

LG
LG el 18 de Mzo. de 2022
I've found a solution through the following. Hope this helps others :)
one=KbName('1!');
Screen('DrawText',win,'Please press 1',100,100)
Screen('Flip', win)
onsetTime=GetSecs;
while KbEventAvail;
[evt,n]=KbEventGet();
if evt.Keycode==one & evt.Pressed==1;
reaction=evt.Time - onsetTime;
end
end

Más respuestas (1)

David Hill
David Hill el 17 de Mzo. de 2022

Categorías

Más información sobre Timing and presenting 2D and 3D stimuli en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by