# OSX: Saving conditions and responses

**URL:** <https://psychtoolbox.discourse.group/t/osx-saving-conditions-and-responses/2068>\
**Category:** Uncategorized\
**Created:** [June 23, 2005, 8:33pm UTC](https://psychtoolbox.discourse.group/t/osx-saving-conditions-and-responses/2068 "2005-06-23T20:33:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_54971](https://avatars.discourse-cdn.com/v4/letter/p/f9ae1b/32.png) [@Peter\_54971](https://psychtoolbox.discourse.group/u/Peter_54971)\
**Post date:** [June 23, 2005, 8:33pm UTC](https://psychtoolbox.discourse.group/t/osx-saving-conditions-and-responses/2068/1 "2005-06-23T20:33:46Z")

</div>

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
