이전 댓글 표시
any good example of a 'switch' command , actually I need to make a code which when executed give me a option of selection and by pressing it it will execute that. Any Help in this .cheers
답변 (2개)
Honglei Chen
2012년 2월 27일
There are several examples in the documentation
doc switch
Jan
2012년 2월 27일
0 개 추천
댓글 수: 5
Nasir Qazi
2012년 2월 27일
Nasir Qazi
2012년 2월 27일
Jiro Doke
2012년 2월 27일
Did you see the examples on the links that Jan provided (for switch and menu)?
Nasir Qazi
2012년 2월 27일
Jiro Doke
2012년 2월 27일
Just combined the first examples from each function...
choice = menu('Choose a color','Red','Blue','Green');
switch choice
case 1
disp('You pressed Red');
case 2
disp('You pressed Blue');
case 3
disp('You pressed Green');
otherwise
disp('You closed the window');
end
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!