help with displaying screen and getting RT

Hello,

I hope this is the appropriate place to ask coding questions.

I am trying to display a screen for a specified period of time and I'm
having trouble displaying the image and recording reaction time while
the image remains up.

I'm trying something like this:

starttime=GetSecs; %start RT when first picture is displayed
SCREEN('CopyWindow',scr_one(j),w); % Copy single picture to
monitor.
pic1 = GetSecs;
[keyIsDown, t, keyCode]=KbCheck;
while (GetSecs - pic1 <= 2)
end

if keyCode(1)==1
Response(1,k)=1 %record keystroke 1 if left mouse, 2 if
right mouse
RT=t-starttime;
Response(2,k)=RT %record reaction time to 2xN matrix
k=k+1;


My image displays for the appropriate amount of time but the kbcheck
function isn't recording the keypress. Matlab's pause function and the
waitsecs function don't seem to be what I want either. I am using
Windows XP and Matlab 6.5.1.

Thanks in advance,

Karl Doron
Boston University
I'm not sure why you have nothing in youe while loop but could it be that you need to put
your if keyCode(1)==1 line in the while loop??


Pat

--- In psychtoolbox@yahoogroups.com, Karl Doron <karld@b...> wrote:
>
> Hello,
>
> I hope this is the appropriate place to ask coding questions.
>
> I am trying to display a screen for a specified period of time and I'm
> having trouble displaying the image and recording reaction time while
> the image remains up.
>
> I'm trying something like this:
>
> starttime=GetSecs; %start RT when first picture is displayed
> SCREEN('CopyWindow',scr_one(j),w); % Copy single picture to
> monitor.
> pic1 = GetSecs;
> [keyIsDown, t, keyCode]=KbCheck;
> while (GetSecs - pic1 <= 2)
> end
>
> if keyCode(1)==1
> Response(1,k)=1 %record keystroke 1 if left mouse, 2 if
> right mouse
> RT=t-starttime;
> Response(2,k)=RT %record reaction time to 2xN matrix
> k=k+1;
>
>
> My image displays for the appropriate amount of time but the kbcheck
> function isn't recording the keypress. Matlab's pause function and the
> waitsecs function don't seem to be what I want either. I am using
> Windows XP and Matlab 6.5.1.
>
> Thanks in advance,
>
> Karl Doron
> Boston University