フィルターのクリア

Or any other key...

5 ビュー (過去 30 日間)
Brett
Brett 2012 年 11 月 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 件のコメント
Brett
Brett 2012 年 11 月 30 日
I ended up grunting it out, but I'm still curious if anyone knows a really easy way to do this. :)
Jan
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?

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2012 年 11 月 30 日
編集済み: Jan 2012 年 11 月 30 日
I try to guess:
Screen('FillRect',window,[0 0 0])
Screen('Flip',window)
keyIndex = find(keyCode(1, [98, 104, 100, 102])); % ???
if q1col && length(keyIndex) == 1 && (q1tri == keyIndex)
WaitSecs(tar);
else
WaitSecs(theOtherTar);
end

カテゴリ

Help Center および File ExchangeTiming and presenting 2D and 3D stimuli についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by