I'm trying to collect key presses and I need to see which key they pressed but MATLAB keeps giving me the numerical code as opposed to the character. How do I get the character as output instead?

 Respuesta aceptada

Niels
Niels el 3 de Feb. de 2015

0 votos

It would be good if you provide us with a snippet of the code you are using right now.
With the current information provided, I can suggest 2 things:
  • Convert the numeric value to a character using char()
  • Use get(gcf,'currentcharacter') to get the actual string

1 comentario

Alice
Alice el 3 de Feb. de 2015
I've been using
[KeyIsDown, secs, KeyCode] = KbCheck;
response(i)=KbName(KeyCode);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 3 de Feb. de 2015

Comentada:

el 3 de Feb. de 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by