trialtest = 5;
invalid = 0;
trialN = trialtest + invalid
spaceTime = 1.5
spaceKey = KbName('space');
tflip = [];
for T = 1: trialN
Screen('DrawLine',w, 0, cx-10, cy, cx+10, cy, 3);
Screen('DrawLine',w, 0, cx, cy-10, cx, cy+10, 3);
Screen('Flip',w);
WaitSecs(1);
Screen('FrameOval',w,0,[cx-40,cy-40,cx+40,cy+40],4);
fixOnset = Screen('Flip',w,tflip);
[space spaceRT] = KeyResponse(spaceTime,0,spaceKey);
mspaceRT = spaceRT*1000;
if space ==1
Screen('DrawLine',w, 0, cx-10, cy, cx+10, cy, 3);
Screen('DrawLine',w, 0, cx, cy-10, cx, cy+10, 3);
Screen('Flip',w);
DrawTextUni(w,['GOOD'],'center',0,-rect(4)*.3);
elseif space == 999
Screen('DrawLine',w, 0, cx-10, cy, cx+10, cy, 3);
Screen('DrawLine',w, 0, cx, cy-10, cx, cy+10, 3);
Screen('Flip',w);
DrawTextUni(w,['BAD'],'center',0,-rect(4)*.3);
invalid = invalid +1
end
trialN = trialtest + invalid
end