Development Environment | ![]() ![]() |
Controlling the Format and Spacing of Numeric Output
By default, numeric output in the Command Windows is displayed as 5-digit scaled, fixed-point values. Use the text display preference to change the numeric format of output. The text display format affects only how numbers are shown, not how MATLAB computes or saves them.
Function Equivalent. Use the format
function to control the output format of the numeric values displayed in the Command Window. The format you specify applies only to the current session.
Examples of Formats. Here are a few examples of the various formats and the output produced from the following two-element vector x
, with components of different magnitudes.
x = [4/3 1.2345e-6] format short e 1.3333e+000 1.2345e-006 format short 1.3333 0.0000 format + ++
For a complete list and description of available formats, see the reference page for format
. If you want more control over the output format, use the sprintf
and fprintf
functions.
Controlling Spacing. Use the text display preference or format
function to control spacing in the output. Use
format compact
to suppress blank lines, allowing you to view more information in the Command Window. To include the blank lines, which can help make output more readable, use
format loose
![]() | Paging of Output in the Command Window | Printing Command Window Contents | ![]() |