If – else statements are a type of conditional statement which performs an action based on whether your expression is true or false.
The matlab command is :
if x == value1 [code] elseif x == value2 [code] else [code] end
For example
if x == 1 disp(‘I am numero uno’); elseif x==2 disp(‘I am the first prime number’); else disp(['I am the number : ',int2str(x)]); end