Dear all,
I am tryiing to write a GUI in which the user must enter the command (RETURN or DELETE) from the keyboard. For that purpose, I wrote a code where I set the 'KeyPressFcn' to read the key pressed by the user. The mais problem is that when the user types "RETURN" or "DELETE" all I get is an empty string.
Here is the code:
function getKey(axeshandle)fig = ancestor(axeshandle, 'figure');set(fig, 'KeyPressFcn', @keyRead);uiwait(fig); function keyRead(src, callback) key = get(fig, 'CurrentCharacter'); strcmp(key, 'return') class(key) endend
Any idea on how can I solve this?
Best Answer