GetChar()関数は、キー押下を待つか、以前に押されたキーをキューから取得します(http://docs.psychtoolbox.org/GetChar)。起こっている可能性があることは、たとえ最新のプレスではないとしても、GetCharによって読み取られているキュー内の以前のキー押下を持っていることです。
しかし、Psychtoolbox開発者は、応答時間を収集するためにGetChar()関数を使用しないことをお勧めします。これは、GetChar()とKbCheck()などの他の関数のタイミングの予見が原因です。
次のスニペットは、応答時間のために、キーボードをポーリングするために使用することができます
% find the keyscan codes for the first four number keys
% (top of the keyboard keys, number pad keys have different codes)
keysToWaitFor = [KbName('!1'), KbName('[email protected]'), KbName('3#'), KbName('4$')];
responded = 0;
while responded == 0
[tmp,KeyTime,KeyCode] = KbCheck(-3);
if KeyCode(keysToWaitFor)
trial(j).RT = KeyTime - startTime;
responded = 1;
end
% time between iterations of KbCheck loop
WaitSecs(0.001);
end
出典
2017-01-03 05:21:52
DMR