我正在尝试记录参与者对需要在固定持续时间(500 毫秒)内显示的视觉刺激的反应。但是,我还想在刺激开始后的 1 秒时间窗口内记录他们在这个固定持续时间后的反应。以下代码仅允许我在刺激呈现期间(500 毫秒)按下键时记录响应。
StimulusSecs = 0.50001;
StimDuration = round(StimulusSecs / ifi);
ISISecs = 0.50001;
ISI = round(ISISecs / ifi);
ITISecs = [1.00001, 2.00001, 3.00001];
intertrial = round(ITISecs / ifi);
waitframes = 1;
vbl = Screen('Flip', mainwin);
t2wait = 1;
[~, Onset]=Screen('Flip', mainwin); keyIsDown=0; rt=0;
tic % Stimulus Onset
for frame = 1:StimDuration
Screen('DrawTexture', mainwin, pics(picCounter));
vbl = Screen('Flip',mainwin, vbl + (waitframes - 0.5) * ifi);
[keyIsDown, secs, keyCode] = KbCheck;
FlushEvents('keyDown');
if keyIsDown
if keyCode(spaceKey)
rt = 1000.*(secs-Onset);
keypressed=find(keyCode);
% break; is missing as this would
% escape the loop
elseif (secs-Onset) > t2wait
break;
elseif keyCode(escKey)
ShowCursor; fclose(outfile); Screen('CloseAll');
return;
end
keyIsDown=0; keyCode=0; keypressed=0;
end
end
S2dur = toc;
我是psychoolbox的新手,任何帮助将不胜感激!!!