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?

 채택된 답변

Niels
Niels 2015년 2월 3일

0 개 추천

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

Alice
Alice 2015년 2월 3일
I've been using
[KeyIsDown, secs, KeyCode] = KbCheck;
response(i)=KbName(KeyCode);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2015년 2월 3일

댓글:

2015년 2월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by