collectResponse.m: Log a response and a response time

In almost every experiment you run, you will want to collect responses and (maybe) response times. I have found the following generic tasks useful and wrote this function to allow flexible specification of the way to record a response and an RT. In essence, you can collect a response based on a particular key, waiting a particular amount of time, and either moving on once the response has been recorded or continuing to wait out the specified duration regardless. In addition, I am lazy and hate spending lots of time running through an experiment myself to make sure it runs. So this function also includes a "test mode" that generates random responses of the specified type (including an occasional non-response) so that you can zoom through a study without having to watch and respond yourself. An example of how to use this test mode can be seen in the sample runChoiceTask.m script.

return to main page