Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: even and odd numbers
Date: Sun, 25 Jan 2009 21:57:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <glin7g$lf7$1@fred.mathworks.com>
References: <glikor$epo$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1232920624 21991 172.30.248.38 (25 Jan 2009 21:57:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 25 Jan 2009 21:57:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:513846

"Rubi " <phreakadelik@hotmail.com> wrote in message <glikor$epo$1@fred.mathworks.com>...
> Hi and thanks for any idea or code !
> 
> Im new at matlab 
> I have an .m file UY=[0.513671875	
> 0.620666504	
> 115.847168	
> 256.2485046	
> 230.8596191	
> ....]
> 
> And i have to separate in a new file the even numbers and odd numbers is that posible having decimals? i searched and i found this code 
> 
> if mod(x,2) == 0
> %number is even
> else
> %number is odd
> end
> 
> Thank you :)

 The quality of being even or odd has meaning only for integers.  However, you can turn your numbers into integers using one of matlab's 'round', 'floor', or 'ceil' functions.  The results of course will be dependent on which of these three you choose to use.

Roger Stafford