Path: news.mathworks.com!not-for-mail
From: "Steve Amphlett" <Firstname.Lastname@Where-I-Work.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Even/odd
Date: Thu, 23 Aug 2007 15:00:21 +0000 (UTC)
Organization: Ricardo UK Ltd
Lines: 16
Message-ID: <fak7e5$d6q$1@fred.mathworks.com>
References: <fak6ev$t2k$1@fred.mathworks.com>
Reply-To: "Steve Amphlett" <Firstname.Lastname@Where-I-Work.com>
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 1187881221 13530 172.30.248.37 (23 Aug 2007 15:00:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 23 Aug 2007 15:00:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 43398
Xref: news.mathworks.com comp.soft-sys.matlab:425222



"Edward Seger" <edward.h.seger@saic.com> wrote in message 
<fak6ev$t2k$1@fred.mathworks.com>...
> How about even and odd functions built-in:
> 
> bool x;
> 
> x = even(num);
> x = odd(num);

So what's wrong with <mod> ?

mod(x,2)

0 if even, 1 if odd