We are preparing a Likert type scale. Subjects must be allowed to just press the numbers of 1-9. We know ListenChar but it suppresses the whole keyboard. How can we suppress non-number keys?
while(1)
ch = GetChar;
if ch == 10 %return is 10 or 13
%terminate
break
else
response=[response ch];
end
end
If you only want to accept keypresses 1-9:
I also added a debounce, so that you don't accidentally log a single input many times.