>> format long eThe loose display of output can be tightened up by the MATLAB command:
>> format compactThere are some more suboptions of the format command which you can find by
>> help format(here ">> " is the MATLAB prompt in my session. If you want to display an output with other than 5 or 15 digits, than you have to use the formatted print command borrowed from the C programming language, for instance
>> b=12.12345678901234567; >> fprintf('value of b is %1.10e\n',b) value of b is 1.2123456789e+01Here, "%n.me" is the exponential format for m digits after the decimal point ("n.mf" is for fixed point format), with much insensitivity to the "n" width of field parameter; "\n" means a line feed; anything else in quotes other than a format mask is taken as a literal string. Use
>> help fprintfin MATLAB for more information. The C-like "sprintf" string print command behaves similarly. See also the MATLAB "disp" command with MATLAB "help" for quick and dirty printing out arrays:
>> help fprintf
Email Comments or Questions to hanson@uic.edu