hpeceeng

Saturday, January 25, 2014

MATLAB - How to use If-else statement in matlab

IF - ELSE STATEMENT IN MATLAB PROGRAM













THIS IS SIMPLE EXAMPLE FOR COMPARING TOW NUMBERS
%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%
clc;
clear all;
close all;
a=input('Enter the value of a');%getting input from command window or user
b=input('Enter the value of b');
if (a>b)%if condition
disp('a is greater then b');%if statement
elseif (a==b)%nested if condition
disp('a is equal to b');
else%else condition
disp('a is smaller then b');
end%termination of if statement
%%%%%%%%%%%%%%%%news4eceeng.blogspot.com%%%%%%%%%%%%%%%%%%%


No comments:

Post a Comment