18_pdfsam_2 - Displaying Values and Text There are three ways to display values and text in Matlab to be described in this section 1 By entering

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
For example: >> format long >> 5.78/57.13 ans = 0.10117276387187 >> format short >> ans ans = 0.1012 Thus, the short result is displayed as 0.1012 instead of 0.1011, which would have been the result if the long display had been truncated to four decimal digits. format compact suppresses many of the line feeds that appear between displays and allows more lines of information to be seen together on the screen. For example: >> temp = 78 temp = 78 >> format compact >> temp=78 temp = 78 In the examples shown in these notes, it is be asseumed that this command has been executed. The command format loose can be used to return to the less compact display mode.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Displaying Values and Text There are three ways to display values and text in Matlab , to be described in this section: 1. By entering the variable name at the Matlab prompt, without a semicolon. 2. By use of the command disp . 3. By use of the command fprintf . • From the prompt: As demonstrated in previous examples, by entering a variable name, an assignment statement, or an expression at the Matlab prompt, without a semicolon, the result will be displayed, proceeded by the variable name (or by ans if only an expression was entered). For example: 31...
View Full Document

This note was uploaded on 03/07/2010 for the course ENG 101 taught by Professor Chang during the Summer '09 term at 東京国際大学.

Ask a homework question - tutors are online