Development Environment |
Formatting and Spacing 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 Alternative
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. More advanced alternatives are listed in the "See Also" section of the format
reference page.
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.
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
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
Paging of Output in the Command Window | Printing Command Window Contents |