Getting Started Previous page   Next Page

Controlling Command Window Input and Output

So far, you have been using the MATLAB command line, typing functions and expressions, and seeing the results printed in the Command Window. This section describes

The format Function

The format function controls the numeric format of the values displayed by MATLAB. The function affects only how numbers are displayed, not how MATLAB computes or saves them. Here are the different formats, together with the resulting output produced from a vector x with components of different magnitudes.

If the largest element of a matrix is larger than 103 or smaller than 10-3, MATLAB applies a common scale factor for the short and long formats.

In addition to the format functions shown above

suppresses many of the blank lines that appear in the output. This lets you view more information on a screen or window. If you want more control over the output format, use the sprintf and fprintf functions.


Previous page  The find Function Suppressing Output Next page

© 1994-2005 The MathWorks, Inc.