Can waitforbuttonpress function be used with switch cases..?

조회 수: 1 (최근 30일)
Nipjyoti Sarma
Nipjyoti Sarma 2016년 10월 21일
댓글: Nipjyoti Sarma 2016년 10월 21일
I have used this piece of Code but it's not working. Can you help me where I am wrong here.. for i=1:10 keydown = waitforbuttonpress; switch keydown case'0' disp(5); case'1' disp(6); end end Thank you.

채택된 답변

Massimo Zanetti
Massimo Zanetti 2016년 10월 21일
Output of waitfrobuttonpress is not a string, is number:
for i=1:10
keydown = waitforbuttonpress;
switch keydown
case 0
disp(5);
case 1
disp(6);
end
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by