Control the format of the output produced by disp and Octave's
normal echoing mechanism. Valid options are listed in the following
table.
short
- Octave will try to print numbers with at
least 5 significant figures within a field that is a maximum of 10
characters wide (not counting additional spacing that is added between
columns of a matrix).
If Octave is unable to format a matrix so that columns line up on the
decimal point and all the numbers fit within the maximum field width
it switches to an e format.
long
- Octave will try to print numbers with at least 15 significant figures
within a field that is a maximum of 20 characters wide (not counting
additional spacing that is added between columns of a matrix).
As will the short format Octave will switch to an e
format if it is unable to format a matrix so that columns line up on the
decimal point and all the numbers fit within the maximum field width.
long e
short e
- The same as
format long or format short but always display
output with an e format. For example with the short e
format pi is displayed as 3.14e+00 .
long E
short E
- The same as
format long e or format short e but always
display output with an uppercase E format. For example with
the long E format pi is displayed as
3.14159265358979E+00 .
long g
short g
- Choose between normal
long (or short ) and and
long e (or short e ) formats based on the magnitude
of the number. For example with the short g format,
pi .^ [2; 4; 8; 16; 32] is displayed as
ans =
3.1416
9.8696
97.409
9488.5
9.0032e+07
8.1058e+15
long G
short G
- The same as
format long g or format short g but use an
uppercase E format. For example with the short G format,
pi .^ [2; 4; 8; 16; 32] is displayed as
ans =
3.1416
9.8696
97.409
9488.5
9.0032E+07
8.1058E+15
free
none
- Print output in free format without trying to line up columns of
matrices on the decimal point. This also causes complex numbers to be
formatted like this
(0.604194 0.607088) instead of like this
0.60419 + 0.60709i .
bank
- Print in a fixed format with two places to the right of the decimal
point.
+
+ chars
plus
plus chars
- Print a
+ symbol for nonzero matrix elements and a space for zero
matrix elements. This format can be very useful for examining the
structure of a large matrix.
The optional argument chars specifies a list of 3 characters to use
for printing values greater than zero less than zero and equal to zero.
For example with the + "+-." format, [1, 0, -1; -1, 0, 1]
is displayed as
ans =
+.-
-.+
native-hex
- Print the hexadecimal representation numbers as they are stored in
memory. For example on a workstation which stores 8 byte real values
in IEEE format with the least significant byte first the value of
pi when printed in hex format is 400921fb54442d18 .
This format only works for numeric values.
hex
- The same as
native-hex but always print the most significant
byte first.
native-bit
- Print the bit representation of numbers as stored in memory.
For example the value of
pi is
01000000000010010010000111111011
01010100010001000010110100011000
(shown here in two 32 bit sections for typesetting purposes) when
printed in bit format on a workstation which stores 8 byte real values
in IEEE format with the least significant byte first. This format only
works for numeric types.
bit
- The same as
native-bit but always print the most significant
bits first.
compact
- Remove extra blank space around column number labels.
loose
- Insert blank lines above and below column number labels (this is the
default).
By default Octave will try to print numbers with at least 5 significant
figures within a field that is a maximum of 10 characters wide.
If Octave is unable to format a matrix so that columns line up on the
decimal point and all the numbers fit within the maximum field width
it switches to an e format.
If format is invoked without any options the default format
state is restored.
|