MATLAB Python

waitForKeyboard

Syntax

[offsetTime, timeWaited, timedOut] = waitForKeyboard(trigger, inputDevice,timeout)

Description

WAITFORKEYBOARD waits until a specific response is detected (e.g., when waiting for the user or for a scanner pulse) with minimal fuss. Reports success and wait times.

Usage

trigger: the trigger key to wait for as a string (e.g., 'Return'). inputDevice: the input device as a string (-1 or blank for keyboard). timeout: the maximum time to wait in seconds. A warning will be presented if no response is received prior to the timeout value. Supply timeout as "inf" or leave empty if you don't want a timeout.