Hi,
one quick internationalization question: how does KbName handle international keyboard layouts?
Using KbName I get response == 'y' whenever I press the Z key (whereas 'z' is echoed in the Command window) and vice versa on a German keyboard [OS X 10.6, Matlab 7.9.0.529 (R2009b), Psychtoolbox 3.0.8 beta rev. 1557 locally modified]. For a real-life example see listing below.
Is this expected? I think I noticed this before, but have coded around it. Nevertheless, to help avoid falling into the same trap again, it is worth mentioning this somewhere in the upper part of the KbName documentation (which btw now show funny characters � after 'help KbName' in the command window and '�' in Terminal).
Best, Jochen
Same happens using the following function:
function response = collectResponse
persistent keyIsDown t00 secs keyCode deltaSecs
responseSet = {'y', 'z'};
responseSetCode = KbName(responseSet);
keyIsDown = true;
while keyIsDown
[keyIsDown, t00, keyCode, deltaSecs] = KbCheck();
end
done = false;
while ~done
[keyIsDown, secs, keyCode, deltaSecs] = KbCheck();
if keyIsDown && sum(keyCode)==1 % only a single key pressed
if any(keyCode(responseSetCode))
response = KbName(keyCode);
done = true;
end
end
end