MATLAB: If statement after use input

if statementinput

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?

Best Answer

Yes,
Variablein = input('type 1,2,or 3:\n');
if (Variablein == 3)
disp('You typed 3');
end
For a string:
Variablein = input('type 1,2,or 3:\n','s');
Variablein = str2num(Variablein);
if (Variablein == 3)
disp('You typed 3');
end