60 likes | 374 Views
Sounds and external devices in Cogent & Matlab. MATLAB for Cognitive Neuroscience Marieke Schölvinck, 19 March 2009. external devices (1)…. keyboard / keypad. config_keyboard waitkeydown ( time in ms , key to be pressed) e.g. (inf,71)
E N D
Sounds and external devices in Cogent & Matlab MATLAB for Cognitive Neuroscience Marieke Schölvinck, 19 March 2009
external devices (1)… keyboard / keypad config_keyboard waitkeydown (time in ms, key to be pressed) e.g. (inf,71) readkeys (useful: help readkeys, to find out key IDs) [k, t, n] = getkeydown (k = key ID, t = time in ms, n = number of keys pressed) n = countkeydown [k, t] = lastkeydown (k = key ID, t = time in ms) logkeys clearkeys
external devices (2)… mouse config_mouse (polling mode and unpolling mode, e.g. (10) ) map = getmousemap (creates structure map with variables: X, Y, Z, Button1-4) readmouse (updates information in map) x = getmouse (get any of the variables in map) eyetracker: in 2 weeks!
Two ways to get sounds: • Load a sound • A .wav file • Make a sound • - In Cogent or Matlab
Cogent Set of predefined commands Matlab One equation: