Capture reaction time - code not working

1 view (last 30 days)
Chelsea
Chelsea on 3 Mar 2015
Hi,
I'm trying to capture simple reaction time, but the code I have isn't working (i.e., gives me RT of 0.00000008, etc.).
Here is what I have...
secs0=GetSecs; % Wait for a keyboard response
respToBeMade = true;
while respToBeMade
[keyIsDown,secs, pressedKeys] = KbCheck;
if pressedKeys(escapeKey);
ShowCursor;
sca;
return;
elseif pressedKeys(upKey);
keyResp = 's';
respToBeMade = false;
elseif pressedKeys(downKey);
keyResp = 'l';
respToBeMade = false;
end
end
RT=secs-secs0; % Get reaction time
Is there something that is clearly wrong here? I can't seem to figure it out, it looks right to me. I'm also using Psychtoolbox if that makes a difference.
Thank you!

Answers (0)

Community Treasure Hunt

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

Start Hunting!