Dear all,
using a Lenovo T400 (with Windows XP, Matlab R2009a, and Psychtoolbox 3,
) and struggling for what felt like years, you are my last hope:
I use KbCheck in a trial to get a precise (not necessary correct) answer
in response to a stimulus display (+10ms, otherwise I don't see any
display). However, every time I run the code it get stuck and the main
window tells me that Matlab is "busy". Maybe that's because of these
"stuck" keys which I would like to disable (if I only knew how to
identify) them ... .
So, my question is essentially twofold:
First: are there errors in my code I simply don't see and especially
concerning the KbCheck command?
Second: how can I identify stuck keys and disable them?
I also used KbWait which seems fine but 5secs is a too large measurement
error - I am sorry. I assume that KbWaitStroke or KbPressWait have
essentially the same measurement error.
Any suggestions are welcome - regards miriam
here the code:
ListenChar(2);
b={'A', 'E', 'U', 'D', 'P', 'W'};
z={'2','4','6','3','5','7'};
ze={'+','>','=','?','ç','@'};
i=1;
results=[];
rt=0;
c=0;
delta=0;
while i<3 ;
b1=RandSample(b);
zi=RandSample(z);
zei=RandSample(ze);
a=b1{1};
zi=zi{1};
zei=zei{1};
intro=Screen('OpenWindow',0, [], [50,50,750,750]);
Screen('TextFont',intro, 'Courier New');
Screen('TextSize',intro, 44);
Screen('TextStyle',intro, 1+2);
Screen('FrameRect',intro, [255, 0, 0],[100,100, 500, 500]);
Screen('DrawText',intro,a, 175, 100, [0, 0, 255]);
Screen('DrawText',intro,zi, 175, 250, [0, 255, 0]);
Screen('DrawText',intro,zei, 175, 400, [255, 0,0]);
pause(0.1 );
while KbCheck
end;
startSecs = GetSecs;
%rt1=KbStrokeWait([1]);
%rt1=KbWait;
%rt=rt1-startSecs;
%pause(5);
while 1
[keyIsDown,timeSecs,keyCode, DeltaSecs] = KbCheck;
if keyIsDown==1
c = KbName(keyCode);
rt = timeSecs - startSecs;
while KbCheck; end
if strcmp(c,'alt')%|| strcmp(c,'space')
break;
end
end
end
results(i,1)=rt;
fprintf('rt %d %f\n' ,i,rt);
results(i,2)=c;
i=i+1;
Screen('CloseAll');
end;
ListenChar(0);
--
Miriam Gade, Dr
University of Zurich
Departement of Psychology, Cognitive Psychology Unit
Binzmühlestrasse 14/22, CH-8050 Zurich
office: BIN 4.B.03
phone: +41 (0)44 635 74 61
http://www.psychologie.uzh.ch/fachrichtungen/allgpsy/Team/Gade_en.html
using a Lenovo T400 (with Windows XP, Matlab R2009a, and Psychtoolbox 3,
) and struggling for what felt like years, you are my last hope:
I use KbCheck in a trial to get a precise (not necessary correct) answer
in response to a stimulus display (+10ms, otherwise I don't see any
display). However, every time I run the code it get stuck and the main
window tells me that Matlab is "busy". Maybe that's because of these
"stuck" keys which I would like to disable (if I only knew how to
identify) them ... .
So, my question is essentially twofold:
First: are there errors in my code I simply don't see and especially
concerning the KbCheck command?
Second: how can I identify stuck keys and disable them?
I also used KbWait which seems fine but 5secs is a too large measurement
error - I am sorry. I assume that KbWaitStroke or KbPressWait have
essentially the same measurement error.
Any suggestions are welcome - regards miriam
here the code:
ListenChar(2);
b={'A', 'E', 'U', 'D', 'P', 'W'};
z={'2','4','6','3','5','7'};
ze={'+','>','=','?','ç','@'};
i=1;
results=[];
rt=0;
c=0;
delta=0;
while i<3 ;
b1=RandSample(b);
zi=RandSample(z);
zei=RandSample(ze);
a=b1{1};
zi=zi{1};
zei=zei{1};
intro=Screen('OpenWindow',0, [], [50,50,750,750]);
Screen('TextFont',intro, 'Courier New');
Screen('TextSize',intro, 44);
Screen('TextStyle',intro, 1+2);
Screen('FrameRect',intro, [255, 0, 0],[100,100, 500, 500]);
Screen('DrawText',intro,a, 175, 100, [0, 0, 255]);
Screen('DrawText',intro,zi, 175, 250, [0, 255, 0]);
Screen('DrawText',intro,zei, 175, 400, [255, 0,0]);
pause(0.1 );
while KbCheck
end;
startSecs = GetSecs;
%rt1=KbStrokeWait([1]);
%rt1=KbWait;
%rt=rt1-startSecs;
%pause(5);
while 1
[keyIsDown,timeSecs,keyCode, DeltaSecs] = KbCheck;
if keyIsDown==1
c = KbName(keyCode);
rt = timeSecs - startSecs;
while KbCheck; end
if strcmp(c,'alt')%|| strcmp(c,'space')
break;
end
end
end
results(i,1)=rt;
fprintf('rt %d %f\n' ,i,rt);
results(i,2)=c;
i=i+1;
Screen('CloseAll');
end;
ListenChar(0);
--
Miriam Gade, Dr
University of Zurich
Departement of Psychology, Cognitive Psychology Unit
Binzmühlestrasse 14/22, CH-8050 Zurich
office: BIN 4.B.03
phone: +41 (0)44 635 74 61
http://www.psychologie.uzh.ch/fachrichtungen/allgpsy/Team/Gade_en.html