Can waitforbuttonpress function be used with switch cases..?
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
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 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!