HI , I WANT TO USE "IF" AND ELSE CONDITIONS IN MATLAB USERDEFINED FUNCTION ?PLZ HELP ME

Answers (2)

Have you just read the MATLAB getting started guide, or the help for if? I think you don't need a book on that alone.
x = 3;
if (x<3)
disp('Do this');
elseif (x>3)
disp('Do this');
else
disp('x is equal to 3.');
end

Asked:

on 7 Apr 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!