Hi All,
I'm writing a code for execute an RSVP detection task, but I have a problem in collecting RT and accuracy.
Basically, what the code do at the moment is to present (in each trial) 16 squares: All squares are black except one which is white and is presented randomly in sequence positions from 6 to 11.
The stimulus (square) time is 133 ms, while the ISI (blank screen) is 367. Therefore the SOA is 500ms.
Participant will have to rapidly press a button (spacebar) when he/she see the white square. So I want to start collect the reaction time from the onset of the white square up to 500 ms (before the next black square appears). If participant will no respond during this time window, no reaction time is collected and accuracy is 0. Importantly, what I want is that the timing of the stimuli and the black screen doesn't change if participant press the spacebar (i.e., i don't want that the keypress determine a short ISI).
The code I usually use to record RT (and accuracy) is like this:
[starttime]= Screen('Flip',window);
endtime=KbQueueWait(); % Wait a Keypress
StimTime=GetSecs;
% while loop to show stimulus until subjects response
[KeyIsDown, endtime, KeyCode]=KbCheck;
if KeyIsDown
RT= round(1000*(endtime-starttime)); %Compute reaction time in second
PressBt=KbName(KeyCode);
break;
end
if KeyCode(seenSquare)==1
acSquare=1;
elseif KeyCode(seenSquare)==0
acSquare=0;
end
I tried to make some changes to the code (and to use KbQueueStart, KbQueueStop...), but what I always get is that the code wait for a keypress to present the next square, or that when the key is pressed it goes to the next stimulus shortening the duration of the blank screen (ISI).
Could you help me?
Thank you very much!
Jessica