

Repeated use of the key recalls earlier lines. Use the key to move the cursor over and insert the missing r. Instead of retyping the entire line, simply press the key. For example, suppose you mistakenly enter The maximum number of characters allowed on a single line is 4096.Ĭommand Line Editing Various arrow and control keys on your keyboard allow you to recall, edit, and reuse commands you have typed earlier. īlank spaces around the =, +, and - signs are optional, but they improve readability. , followed by Return or Enter to indicate that the statement continues on the next line. Long Command Lines If a statement does not fit on one line, use three periods. This is particularly useful when you generate large matrices. However, if you end the line with a semicolon, MATLAB performs the computation but does not display any output.

Suppressing Output If you simply type a statement and press Return or Enter, MATLAB automatically displays the results on screen. If you want more control over the output format, use the sprintf and fprintf functions. This lets you view more information on a screen or window. Suppresses many of the blank lines that appear in the output. In addition to the format commands shown above MATLAB applies a common scale factor for the short and long formats. If the largest element of a matrix is larger than 10 3 or smaller than 10 -3,

Here are the different formats, together with the resulting output produced from a vector x with components of different magnitudes.ġ.333333333333333e+000 1.234500000000000e-006 The command affects only how numbers are displayed, not how MATLAB computes or saves them. The format Command The format command controls the numeric format of the values displayed by MATLAB. If your system allows you to select the command window font or typeface, we recommend you use a fixed width font, such as Fixedsys or Courier, to provide proper spacing. This section describes a few ways of altering the appearance of the command window. The Command Window So far, you have been using the MATLAB command line, typing commands and expressions, and seeing the results printed in the command window. Getting Started Getting Started with MATLAB
