Or any other key...
2 次查看(过去 30 天)
显示 更早的评论
This is my code:
[keyIsDown,secs,keyCode, deltaSecs] = KbCheck
while keyIsDown == 0; %Will present this screen until a key is pressed
[keyIsDown, secs, keyCode, deltaSecs] = KbCheck;
%RT = GetSecs - starttrial - time;
if q1tri == 1 && q1col == 1 && keyCode(1,98) == 1 %down
Screen('FillRect',window,[0 0 0])
Screen('Flip',window)
WaitSecs(tar);
elseif q1tri == 2 && q1col == 1 && keyCode(1,104) == 1 %up
Screen('FillRect',window,[0 0 0])
Screen('Flip',window)
WaitSecs(tar);
elseif q1tri == 3 && q1col == 1 && keyCode(1,100) == 1; %left
Screen('FillRect',window,[0 0 0])
Screen('Flip',window)
WaitSecs(tar);
elseif q1tri == 4 && q1col == 1 && keyCode(1,102) == 1; %right
Screen('FillRect',window,[0 0 0])
Screen('Flip',window)
WaitSecs(tar);
end
What this says is that when a target color is present, and the keyboard arrow key matches the arrow displayed it produces a black screen for a particular amount of time. What I need is code that says something like if any other key is pressed (including the arrow keys that don't match), it produces a black screen for a different amount of time. I tried using pause and input commands, but they didn't seem to work. :(
any help, would be super appreciated, Brett
2 个评论
Jan
2012-11-30
I do not understand the question. I do neither know the function KbCheck(), not the values of the variables q1col, q1tri and tar. What is "the arraow displayed"? Is the replied keyCode really a vector?
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!