now, with the help of mapKeys (3rd example could be improved)
lum =
KbKeysAction(keyCodes, 'a', 's', lum, -50, 50);
depth =
KbKeysAction(keyCodes, 'z', 'x', depth, -50, 50);
quitTime =
KbKeysAction(keyCodes, '', 'q', 0, 0, 1);
end
Psychtoolbox/PsychBasic/KbKeysAction.m