KbQueueCheck

>Psychtoolbox>PsychBasic

[pressed, firstPress, firstRelease, lastPress, lastRelease] = KbQueueCheck([deviceIndex])

Obtains data about keypresses on the specified device since the
most recent call to this routine, KbQueueStart, or KbQueueWait
Clears all scored events, but unscored events that are still being
processed may remain in the queue

pressed: a boolean indicating whether a key has been pressed

firstPress: an array indicating the time that each key was first
pressed since the most recent call to KbQueueCheck or KbQueueStart

firstRelease: an array indicating the time that each key was first
released since the most recent call to KbQueueCheck or KbQueueStart

lastPress: an array indicating the most recent time that each key was
pressed since the most recent call to KbQueueCheck or KbQueueStart

lastRelease: an array indicating the most recent time that each key
was released since the most recent call to KbQueueCheck or
KbQueueStart

For firstPress, firstRelease, lastPress and lastRelease, a time value
of zero indicates that no event for the corresponding key was
detected since the most recent call to KbQueueCheck or KbQueueStart

To identify specific keys, use KbName (e.g., KbName(firstPress)) to
generate a list of the keys for which the events occurred

For compatibility with KbCheck, any key codes stored in
ptb_kbcheck_disabledKeys (see “help DisableKeysForKbCheck”), will
not caused pressed to return as true and will be zeroed out in the
returned arrays. However, a better alternative is to specify a
keyList argument to KbQueueCreate.

_________________________________________________________________________

See also: KbQueueCreate, KbQueueStart, KbQueueStop, KbQueueCheck,
KbQueueWait, KbQueueFlush, KbQueueRelease

Path   Retrieve current version from GitHub | View changelog
Psychtoolbox/PsychBasic/KbQueueCheck.m