switch
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (2)
Honglei Chen
el 27 de Feb. de 2012
There are several examples in the documentation
doc switch
0 comentarios
Jan
el 27 de Feb. de 2012
5 comentarios
Jiro Doke
el 27 de Feb. de 2012
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
Ver también
Categorías
Más información sobre Instrument Control Toolbox Supported Hardware en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!