Can waitforbuttonpress function be used with switch cases..?

2 ビュー (過去 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 Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by