For my experiment I want to present a stimulus and some instructions to the participant. Then 2 seconds later I want the stimulus to disappear but the instructions to remain until the participant responds. Participants should be able to respond immediately after the presentation of the stimulus and up to 10 seconds after its presentation. Response time will be recorded.
With my current code participants aren't able to respond until after 2 seconds (after the stimulus disappears). Is there someway for the stimulus to only appear for 2 seconds while the instructions remain on the screen, but participants are able to respond immediately after the presentation of the stimulus?
%Show the instructions and the stimulus
Screen('DrawTexture', window, randFaceTexture2);
DrawFormattedText(window, [instructions1], 'center', 600)
stimTime = Screen('Flip', window);
WaitSecs(2);
%Stimulus disappears but instructions remain
DrawFormattedText(window, [instructions1], 'center', 600)
Screen('Flip', window);
if GetSecs() <= stimTime + 10
keyIsDown = 0;
startTime = GetSecs();
while 1
[keyIsDown, secs, keyCode] = KbCheck;
FlushEvents('keyDown');
if keyIsDown
nKeys = sum(keyCode);
if nKeys == 1
if keyCode(yes) || keyCode(no)
reactionTime = 1000*(GetSecs - startTime);
response = KbName(keyCode);
Screen('Flip', window);
break;
elseif keyCode(escKey)
ShowCursor;
fclose(outfile);
Screen('CloseAll');
return
end
keyIsDown = 0;
keyCode = 0;
end
end
end
else
line3 = 'Sorry you''re out of time';
DrawFormattedText(window, line3, 'center', 'center');
Screen('Flip', window);
keyIsDown = 0;
rt = 0;
end