The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: how to round to 2 decimal?
Replies: 12   Last Post: Oct 18, 2015 7:19 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nasser Abbasi

Posts: 6,677
Registered: 2/7/05
Re: how to round to 2 decimal?
Posted: Mar 6, 2013 12:13 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 3/5/2013 7:33 AM, wrote:
> On Tuesday, March 4, 2008 8:23:02 PM UTC+5, Deo wrote:
>> hey, how can I set my matlab program to round all the
>> double numbers to 2 decimals

> x=pi;
> sprintf('%.2f',x)
> now type this code in your m file and run it your output will be:
> x
> 3.14

But this does not round x to 2 decimal places.

x does not change in any way after this call.


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.