OSX: Saving conditions and responses

Hi Folks,

We have designed an experimental procedure in which several different stimuli are
presented in randomized order to subjects. After each stimulus presentation, we want to
wait for a subject's response. Ideally, over the experimental session we'd record each trial
number, stimulus condition, and subject response (and a few other parameters). However,
we've had trouble finding a set of commands that will do this correctly. Given that we're
running on Mac (Matlab 7.04 and current PTB), we're limited to using fprintf (to MS Word)
and/or csvwrite (to create .dat files).

Does anyone out there have a snippet of code or a short example program that would
achieve this kind of thing?

By the way, we've also been following the threads that address KbCheck, etc. In our own
experience, if we use KbWait, KbCheck, and KbName in conjunction in a loop that gathers
responses, we always have to keypress n+1 times to get n responses. The first keypress
isn't recorded.

We would appreciate any comment or advice on either of these issues.

Cheers,
People in Tim Petersik's lab