if statement after use input
Mostrar comentarios más antiguos
Is there a possibility of performing an if statement following an user input. For exampl:
Variable = input('type 1,2, or 3 :');
Then stating that if the user typed 1...
I would like to use different values in my equations depending on the value inserted by the user, is this possible?
Respuesta aceptada
Más respuestas (1)
Oleg Komarov
el 28 de Feb. de 2012
I don't understand probably, but:
Variable = input('type 1,2, or 3 :')
if Variable == 1
...
elseif Variable == 2
...
elseif Variable == 3
...
else
...
end
Or use a switch case statement.
Categorías
Más información sobre String Parsing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!