我正在尝试使用 Psychtoolbox 在 MATLAB R2014b 中创建一个简单的 RT 实验。参与者必须对面孔进行分类,尽可能快地按下两个按钮之一。我在一台计算机上创建了范例,它运行良好,但是当我将它移到另一台(我想要测试的那个)上时,出现了一个奇怪的错误:即使程序似乎正在记录按键大多数试验,有时它不会响应,我必须按几次键才能进行下一次试验。我不确定发生了什么,但我认为计算机本身可能有问题(可能是什么?),或者代码的这个特定位:
Screen('Flip', mainwin);
timeStart = GetSecs;keyIsDown=0; correct=0; rt=0;
while 1
bf = 0; %this variable is irrelevant here, I use it later to break
out of a loop
while (GetSecs - timeStart) < 0.2 %faces are presented briefly, but
%I'm recording responses here anyway, just in case there are some
%fast anticipatory responses - after this loop is over, I keep
%recording RT and button press the exact same way, but with no
%stimulus present
[keyIsDown, secs, keyCode] = KbCheck;
FlushEvents('keyDown');
if keyIsDown
nKeys = sum(keyCode);
if nKeys==1
if keyCode(Key1)||keyCode(Key2)
rt = 1000.*(GetSecs-timeStart);
keypressed=find(keyCode);
Screen('Flip', mainwin);
type = 'T';
bf = 1;
if keyCode(Key1) & targ_pic == 1
correct = 1;
elseif keyCode(Key2) & targ_pic == 0
correct = 1;
end
break;
elseif keyCode(escKey)
ShowCursor; fclose(outfile); Screen('CloseAll');
return
end
keyIsDown=0; keyCode=0;
end
else
keypressed = 0;
end
end
谁能发现这可能有问题?
顺便说一句:这是让 RT 退出 PTB 的正确方法吗?我在网上找到了那段代码,但我有点不确定为什么不使用“secs”变量。
两台计算机都运行 Windows 10。