MATLAB: How to use If else statements

MATLAB

Hi everyone, I have tried programming in Matlab to check if a number is in the range of 10-20 (use if-else), but I couldn't get the exected results.
Can I get help please?
Thank you in advance for your help.

Best Answer

Hi Danny,
For using if-else function, I recommend you to type <help if> in matlab command line or this link if, elseif, else to see the documentation of how to use help function.
I will show you an example to check if a number is in 10-20. But Im not sure whether it is want you want to see unless you could show us more details about your script.
i = input('please enter a number:');
if i<=20&&i>=10
disp('this number is in the range of 10-20');
else
disp('this number is NOT in the range of 10-20');
end