Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: if else - odd -even in Matlab
Date: Thu, 10 Mar 2011 15:25:06 +0000 (UTC)
Organization: Xoran Technologies
Lines: 44
Message-ID: <ilaqgi$ckt$1@fred.mathworks.com>
References: <g7qesi$8nl$1@fred.mathworks.com> <ilapb1$nic$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1299770706 12957 172.30.248.38 (10 Mar 2011 15:25:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 10 Mar 2011 15:25:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:715050

"james " <james.franklin.uk@googlemail.com> wrote in message <ilapb1$nic$1@fred.mathworks.com>...
> 
> a dead thread without an answer
> 
> x = uint8(1);
> 
> x= a number of your choice
> 
> test=x/2;
> 
> decide=isinteger(test);
===================


I'm not sure why you think the many previous posts provided no answer. Regardless, your proposal doesn't work, as this example shows

>> x=uint8(1);
>> x=4;
>> test=x/2

test =

     2

>> decide=isinteger(test)  %concludes that the choice x=4 was odd

decide =

     0


A modification of your idea that would work is as follows

>> x=4; decide=isequal(x/2,uint64(x/2)),

decide =

     1

>> x=5; decide=isequal(x/2,uint64(x/2)),

decide =

     0