Hello,
I am trying to write code (using Matlab 2020, Windows 10, PTB 3) which captures the reaction time of a left or right mouseclick within a fixed duration of 3 seconds. It seems like the function ‘GetClicks’ would be good for this, however, it indefinitely waits for a click even when I put it within a while loop, so if the mouse is never clicked, the program will never proceed. Any suggestions/pointers on how to automatically proceed past the GetClicks line after 3 seconds regardless of whether there is a mouse click or not would be greatly appreciated.
trialTimeout=3;
startTime = Screen(‘Flip’, window1);
while GetSecs - startTime < trialTimeout
[clicks,x,y,whichButton] = GetClicks(window1);
respTime = GetSecs; %never gets to here if no mouse click
end
~Andy