I have been mostly programming this task on the lab computer, my keypresses were being logged with mostly the same code (~95%, I’ve made some placement changes). Now, (on my macOS laptop; Ventura.13.2.1) it is not working. The variable keyIsDown reports no key is pressed (0) but somehow it is advancing through my loop. I have spent a couple hours trying to look at the documentation and perusing the internet, but nothing provides me to a solution. I am seeking assistance with the following issues.
Problem 1: Keypress ‘reject key’ not being logged/saved
Problem 2. The loop (trials) do not restart after the fixation screen
while KbCheck
end
go = 0;
while go == 0
[keyIsDown, secs, keyCode] = KbCheck(-1);% read the current status of the keyboard; secs is the time of the key press
if keyIsDown % keyIsDown is a variable that is a 1 if a key is pressed and 0 if no key is pressed
if keyCode(accept_key) % logic test, if the value of keyCode corresponding to 'accept_key' is pressed
pchoice = 1;
trialMatrix(t,1)= cellstr(pchoice_name{pchoice});
WaitSecs(2);
FlushEvents('keyDown');
-------- % some conditional statements for other keypresses follow but are not relevant to my question, so they have been removed (it's alot)
else
keyCode(reject_key)
pchoice = 2;
trialMatrix(t,1)= cellstr(pchoice_name{pchoice});
end
end
end
WaitSecs(1);
Screen('TextSize',ptb.win, 50);
DrawFormattedText(ptb.win, balance_string ,'center', 'center', [0 0 0]);
Screen('Flip', ptb.win);
WaitSecs(1);
cd('/Users/jt394/Documents/Task Code');
fix=imread('fixationcross.jpg');
fixc= Screen('MakeTexture', ptb.win, fix);
Screen('DrawTexture', ptb.win, fixc,[],[]);
Screen('Flip', ptb.win);
end
Any and all help is welcomed and appreciated!