Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Rounding decimals off in multiple columns
Date: Thu, 3 Jan 2013 21:37:08 +0000 (UTC)
Organization: Bogazici
Lines: 30
Message-ID: <kc4tm4$78b$1@newscl01ah.mathworks.com>
References: <gjarn1$87n$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1357249028 7435 172.30.248.46 (3 Jan 2013 21:37:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 3 Jan 2013 21:37:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3951820
Xref: news.mathworks.com comp.soft-sys.matlab:785899

"Ryan Neilson" <rneilson3@cogeco.ca> wrote in message <gjarn1$87n$1@fred.mathworks.com>...
> Hello:
> 
> I'm trying to round-off data in columns to three decimals and was hoping for some useful assistance!
> 
> In the array, I need to round 5 columns (columns #4-8) to three decimals places. There are 1,099 rows in these columns if that's helpful/useful whatsoever.
> 
> Thanks in advance!

Thanks to everyone who is sharing lots of useful information in here. Just did lots of logging issue to be able to share this simple "excel trick": Want to cut of all unnecessary part of 0.1111111111111 just take mod in decimal precision I need 0.1 ,0.01 or 0.001.

Then subtract it from the number it self... Here you are

>> mod(0.111111111,0.01)

ans =

    0.0011

>> mod(0.111111111,0.001)

ans =

  1.1111e-004

>> 0.111111111-ans

ans =

    0.1110