Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

limit decimals
Dear friends,

Is there any way to limit the decimals?

Thank you

Report this thread to moderator Post Follow-up to this message
Old Post
bru
07-13-06 09:11 AM


Re: limit decimals
see

help format

and look at long and short

Report this thread to moderator Post Follow-up to this message
Old Post
Dan Pearce
07-13-06 09:11 AM


Re: limit decimals
Thanks!!!

But i have to use it before i use each variable or i can put it in
some way that will be used for all?

Dan Pearce wrote:
>
>
> see
>
> help format
>
> and look at long and short

Report this thread to moderator Post Follow-up to this message
Old Post
bru
07-13-06 01:06 PM


Re: limit decimals
I'm guessing you are looking for something like 'int', 'double',
'float' etc...

As it says at the top of the 'help format' comment

"All computations in MATLAB are done in double precision.
FORMAT may be used to switch between different output"

so there isn't anything you will be able to change other than the way
the results of calculation are displayed or saved.

Why were you looking to change it? Maybe we can help you more if we
know a bit more about your problem

Report this thread to moderator Post Follow-up to this message
Old Post
Dan Pearce
07-13-06 01:06 PM


Re: limit decimals
The problem is that i'm making a program to calculate the transfer
function and the Zin of a subscriber loop... i have to make a lot of
operations and some people wants it with a lot of precision (a lot of
more operations..). If i do this, the pc needs a lot of ram and goes
very slow. I want to try to reduce the decimals because maybe in this
way i make that the program runs faster...
Thanks a lot and sorry for my bad english !

Dan Pearce wrote:
>
>
> I'm guessing you are looking for something like 'int', 'double',
> 'float' etc...
>
> As it says at the top of the 'help format' comment
>
> "All computations in MATLAB are done in double precision.
> FORMAT may be used to switch between different output"
>
> so there isn't anything you will be able to change other than the
> way
> the results of calculation are displayed or saved.
>
> Why were you looking to change it? Maybe we can help you more if we
> know a bit more about your problem

Report this thread to moderator Post Follow-up to this message
Old Post
bru
07-13-06 01:06 PM


Re: limit decimals
Obviously I don't know your problem, but I am not sure how you can
have "some people want it with a lot of precision" as a problem and
then "try to reduce the decimals" as a possible resolution. It seems
a little counter intuitive to me.

If you have problems with speed then you should be looking to
vectorise as much of your code as possible, or even to try and split
your operations down so that they do not demand so much RAM at one
time.

Report this thread to moderator Post Follow-up to this message
Old Post
Dan Pearce
07-13-06 01:06 PM


Re: limit decimals
bru wrote:
>
>
> The problem is that i'm making a program to calculate the transfer
> function and the Zin of a subscriber loop... i have to make a lot
> of
> operations and some people wants it with a lot of precision (a lot
> of
> more operations..). If i do this, the pc needs a lot of ram and
> goes
> very slow. I want to try to reduce the decimals because maybe in
> this
> way i make that the program runs faster...
> Thanks a lot and sorry for my bad english !
>
> Dan Pearce wrote: 
'double', 
the 
if
> we 

Just put,
format short e %for 5 digit precision
or
format long e %for 15 digit precision
at the top of your m-file(program).

Report this thread to moderator Post Follow-up to this message
Old Post
Aditya vedantam
07-13-06 01:06 PM


Re: limit decimals
Aditya vedantam wrote:
>
>
> bru wrote: 
> transfer 
lot 
> lot 
in 
> 'double', 
than
> the 
more
> if 
>
> Just put,
> format short e %for 5 digit precision
> or
> format long e %for 15 digit precision
> at the top of your m-file(program).

Yeah but,"trying to reduce the decimals" is no way to increase
computational speed.Try vectorizing the code.

Report this thread to moderator Post Follow-up to this message
Old Post
Aditya vedantam
07-13-06 01:06 PM


Re: limit decimals
> Aditya vedantam wrote:

> Just put,
> format short e %for 5 digit precision
> or
> format long e %for 15 digit precision
> at the top of your m-file(program).

This wont speed up the code. All computations in MATLAB are done in
double precision! This only changes the accuracy to which the results
displayed

Report this thread to moderator Post Follow-up to this message
Old Post
Dan Pearce
07-13-06 01:06 PM


Re: limit decimals
Aditya vedantam wrote:
> Yeah but,"trying to reduce the decimals" is no way to increase
> computational speed.Try vectorizing the code.


How can i do this? ^o)

Report this thread to moderator Post Follow-up to this message
Old Post
bru
07-13-06 01:06 PM


Sponsored Links




Last Thread Next Thread Next
Pages (2): [1] 2 »
Search this forum -> 
Post New Thread

Matlab archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 03:29 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.