Access Keys:
Skip to content (Access Key - 0)

How can I change MATLAB's output format or precision?

Matlab always works in double precision (unless you are using the Symbolic Math Toolbox), but output display can be changed with the "format" command. From the Matlab prompt,

>> help format

 FORMAT Set output format.
    All computations in MATLAB are done in double precision.
    FORMAT may be used to switch between different output
    display formats as follows:
      FORMAT         Default. Same as SHORT.
      FORMAT SHORT   Scaled fixed point format with 5 digits.
      FORMAT LONG    Scaled fixed point format with 15 digits.
      FORMAT SHORT E Floating point format with 5 digits.
      FORMAT LONG E  Floating point format with 15 digits.
      FORMAT SHORT G Best of fixed or floating point format with 5 digits.
      FORMAT LONG G  Best of fixed or floating point format with 15 digits.
      FORMAT HEX     Hexadecimal format.
      FORMAT +       The symbols +, - and blank are printed 
                     for positive, negative and zero elements.
                     Imaginary parts are ignored.
      FORMAT BANK    Fixed format for dollars and cents.
      FORMAT RAT     Approximation by ratio of small integers.
 
    Spacing:
      FORMAT COMPACT Suppress extra line-feeds.
      FORMAT LOOSE   Puts the extra line-feeds back in.

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

February 18, 2009

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
olc-matlab olc-matlab Delete
matlab matlab Delete
output output Delete
format format Delete
precision precision Delete
matlab-review matlab-review Delete
sam-duplicate sam-duplicate Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki