PsychToolBox - KbQueue Check Inconsistency

5 visualizzazioni (ultimi 30 giorni)
Daniel
Daniel il 13 Gen 2015
Hey Matlabbers and PTBers,
I'm having an issue with my fMRI experiment while using KbQueueCheck. I have it successfully detecting the scanner trigger key-press ('t') but later in my experiment when I am checking for a subject response key-press ('y') it does not detect a press. All tests have been done on my MacBook Air keyboard.
Here is an example of my code for the trigger (working) and the target response (not working). ____________________________________________________________________________
%Trigger (working) KbName('UnifyKeyNames') TRIG = KbName('t'); TARG = KbName('y');
[id,name] = GetKeyboardIndices; % may need adjustment
buttonbox=0;
for i=1:length(name) %for each possible device buttonbox=id(i); %grab the correct id, and exit loop break; end %reset Kb to only accept trigger klist = zeros(1,256); klist(TRIG) = 1; KbQueueCreate(buttonbox, klist); KbQueueStart(buttonbox);
% waits for initian scanner trigger to begin run DrawFormattedText(win,'The task will begin momentarily.','center','center',White); Screen('Flip',win); KbQueueFlush(buttonbox); while (1) [pressed, x1, x2, keyCode, x3] = KbQueueCheck(buttonbox); .... ....
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Target (not working) [id,name] = GetKeyboardIndices; % may need adjustment
buttonbox=0;
for i=1:length(name) %for each possible device
buttonbox=id(i); %grab the correct id, and exit loop
break;
end
klist = zeros(1,256);
klist(TARG) = 1;
KbQueueRelease(buttonbox);
KbQueueCreate(buttonbox, klist);
KbQueueStart(buttonbox);
%Screen(win,'PutImage',targetImage); %Screen(win, 'Flip');
KbQueueFlush(buttonbox);
while (trialTime < startTime+maxTime)
disp('in the while');
Screen(win,'PutImage',targetImage);
Screen(win, 'Flip');
%ListenChar; %%
%[pressed time] = GetChar();
%[event nremaining] = KbEventGet(buttonbox, 0); %locks up program
%[pressed, x1, x2, keyCode, x3] = KbQueueCheck;
%[pressed, x1, keyCode, x3] = KbCheck;
[pressed, x1, x2, keyCode, x3] = KbQueueCheck(buttonbox);
....
.....
______________________________________________________________________
As you can see I re-declare the buttonbox ID and reinitiate KbQueue for the new keylist. I've also tried a variety of detection methods for a keypress with only KbCheck working. This is not ideal as we wanted to use KbQueueCheck to prevent missing button presses during scanning as occurred in our PrePilot scan. Any suggestions would be greatly appreciated whether it is using KbQueueCheck or one of the other methods.
Thanks, Dan

Risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by