Per advice, I am not using GetChar with Matlab R14 (7.0.1), rather, I am using KbCheck.
However, the following code snippet just loops forever... Why isn't it reading my
keypresses?
-m
escKey = KbName('escape');
noKey = KbName('z');
yesKey = KbName('/');
startTime = GetSecs;
while (1)
[keyIsDown,stopTime,keyCode] = KbCheck;
if keyCode(escKey);
ShowCursor;
Screen('CloseAll');
clear all;
error('Program interrupted by user.');
else
if keyCode(noKey)
response = 0;
break;
elseif keyCode(yesKey)
response = 1;
break;
end
end
end
rt = stopTime-startTime;
However, the following code snippet just loops forever... Why isn't it reading my
keypresses?
-m
escKey = KbName('escape');
noKey = KbName('z');
yesKey = KbName('/');
startTime = GetSecs;
while (1)
[keyIsDown,stopTime,keyCode] = KbCheck;
if keyCode(escKey);
ShowCursor;
Screen('CloseAll');
clear all;
error('Program interrupted by user.');
else
if keyCode(noKey)
response = 0;
break;
elseif keyCode(yesKey)
response = 1;
break;
end
end
end
rt = stopTime-startTime;