format

Purpose

Control the output display format.

Synopsis

See "Description" below.

Description

format switches between different display formats:

-------------------------------------------------------------------
Command          Result                       Example                
-------------------------------------------------------------------
format short     5 digit scaled fixed point   3.1416                 
format long      15 digit scaled fixed point  3.14159265358979       
format short e   5 digit floating-point       3.1416e+00             
format long e    16 digit floating-point      3.141592653589793e+00  
format hex       Hexadecimal                  400921fb54442d18       
format bank      Fixed dollars and cents      3.14                   
format rat       Ratio of small integers      355/113                
format +         +,-, blank                  +                      
format compact   Suppresses excess line                              
                 feeds and results in a                              
                 slightly more compact dis                           
                 play. Does not affect the                           
                 numeric format.                                     
format loose     Reverts to the more open                            
                 display. Does not affect                            
                 the numeric format.                                 
format           Returns to the default for                          
                 mats, short and loose.                              
-------------------------------------------------------------------
By default, MATLAB displays numbers in a short format with five decimal digits.

Algorithms

format + displays +, -, and blank characters for positive, negative, and zero elements. The spy function uses graphics to display essentially the same information more effectively. format hex displays the hexadecimal representation of the binary double-precision number for each element. format rat uses a continued fraction algorithm to approximate floating-point values by ratios of small integers. See rat.m for the complete code in an M-file.

See Also

fprintf, num2str, rat, sprintf, spy

(c) Copyright 1994 by The MathWorks, Inc.