key pressed not recognized

Have R2012a running on Win7. When using the following script I don't seem to be able getting the key pressed recognized. Script works on other computers. Help appreciated.
function youPress(~,eventdata)
if eventdata.Key== 'k'
beep
elseif eventdata.Key== 'd'
beep beep beep
end
end

댓글 수: 1

Walter Roberson
Walter Roberson 2012년 10월 30일
Which kind of callback is this registered against, and which graphic object?

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

답변 (1개)

Sean de Wolski
Sean de Wolski 2012년 10월 30일

0 개 추천

If you just comment everything out:
function youPress(~,eventdata)
disp('hello world')
% if eventdata.Key== 'k'
% elseif eventdata.Key== 'd'
% beep beep beep
% end
end
And then put focus on the figure and press a key, do you see 'hello world' printed?

카테고리

질문:

2012년 10월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by