Collecting a key press

조회 수: 11 (최근 30일)
Alice
Alice 2015년 2월 3일
댓글: Alice 2015년 2월 3일
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일
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개)

카테고리

Help CenterFile Exchange에서 Timing and presenting 2D and 3D stimuli에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by