Hi everyone,
Thanks for the help provided through this forum. This is my problem: I have something like this
%I generate two stimuli and a fixation cross and I present them simultaneously
% here is the first stimulus
Screen('FillOval', w, [255 255 255], Stimulus1);
% here is my fixation cross
[X,Y] = RectCenter(scherm);
FixCross = [X-0.5,Y-20,X+0.5,Y+20;X-20,Y-0.5,X+20,Y+0.5];
Screen('FillRect', w, [255 0 0], FixCross');
%here is the second stimulus
Screen('FillOval', w, stimColor,sizesS);
% now the two stimuli are presented on the screen one on the left and one on the right with the fixation cross in the middle
onset = Screen('Flip',w,onset + (waitframes - 0.5) *1* ifi);
% The subjects has to make a decision between the two stimuli by pressing left or right and I record the key they press and reaction times
tStart = GetSecs;
respToBeMade = true;
while respToBeMade
[keyIsDown,secs(i), keyCode(i)] = KbCheck;
if keyCode(escapeKey)
ShowCursor;
sca;
return
elseif keyCode(leftKey)
response = 1;
respToBeMade = false;
elseif keyCode(rightKey)
response = 0;
respToBeMade = false;
end
end
% Here are the reaction times
tEnd = GetSecs;
rt(j) = tEnd - tStart;
Now, my problem is that if I run the script, after I press a button for a response in the first trial I am presented with a trail that remains on the screen for few msecs and then another trial during which I can give a response. And then again, one trial flips fastly and a second one 'remains on the screen' so in the end I can collect only reaction times for half of the trials. Of course I want to collect reaction times for all trials and not only for one out of two! One thing I noticed is that if I change the following code
% The subjects has to make a decision between the two stimuli by pressing left or right and I record the key they press and reaction times
tStart = GetSecs;
respToBeMade = true;
while respToBeMade
[keyIsDown,secs(i), keyCode(i)] = KbCheck;
if keyCode(escapeKey)
ShowCursor;
sca;
return
elseif keyCode(leftKey)
response = 1;
respToBeMade = false;
elseif keyCode(rightKey)
response = 0;
respToBeMade = false;
end
end
% Here are the reaction times
tEnd = GetSecs;
rt(j) = tEnd - tStart;
I hope my question is well formulated and clear.
Thank you in advance,
Joe