Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: if else - odd -even in Matlab
Date: Mon, 11 Aug 2008 22:36:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <g7qesi$8nl$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1218494162 8949 172.30.248.37 (11 Aug 2008 22:36:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 11 Aug 2008 22:36:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1429477
Xref: news.mathworks.com comp.soft-sys.matlab:484985


Hello everybody!

Can anybody guide me how to do this right in matlab.
Actually How I can distinguish odd from even from numbers (0
to 8 with if and else)?

ex. if x==1 or x==3 or x==5 or x==7 do that else if x==0 or
x==2 or x==4 or x==6 or x==8 do that.

if (x==1 or x==3 or x==5 or x==7)
  .
  .%do this
  .
elseif (x==0 or x==2 or x==4 or x==6 or x==8)
  .
  .%do this
  .
end;

Kindly suggest me how to do it..

Thanks in advance