MATLAB: Change variable value based on other variable in if loop

if statementMATLAB

I have a simple code that takes a user's input, and then changes 2 variables based on that:
var1 = 0;
var2 = 0;
in1 = input('first: ', 's');
in2 = input('second: ', 's');
if in1 = 3 && in2 = 4;
var1 = 2;
var2 = 5;
elseif in1 = 6 && in2 = 7;
var1 = 8;
var2 = 9;
else
disp('invalid input');
end
I didn't really expect it to work, as I was sure I had the syntax wrong. I get the error:
The expression to the left of the equals sign is not a valid target for an assignment.
and I am wondering how I can fix the syntax.

Best Answer

Your input command is requesting a string input:
in1 = input('first: ','s');
in2 = input('second: ','s');
This results in in1 and in2 being strings.
To input them as numbers, simply omit the 's'
in1 = input('first: ');
in2 = input('second: ')'
Also, to perform logical comparrison, use 2 equal signs, e.g.:
if in1 == 3 && in2 == 4