필터 지우기
필터 지우기

Capture reaction time to specific button press

조회 수: 11 (최근 30일)
LG
LG 2022년 3월 17일
답변: LG 2022년 3월 18일
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

채택된 답변

LG
LG 2022년 3월 18일
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

추가 답변 (1개)

David Hill
David Hill 2022년 3월 17일

카테고리

Help CenterFile Exchange에서 Timing and presenting 2D and 3D stimuli에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by