For the control of data display form, there is a special command format in matlab.
However, this command does not affect the data storage form and calculation accuracy.
Format default format
Fixed point with short format and long length of 5 words
Format length 15 word length fixed point
Format short e 5 word length floating point number
Format E Long 15 word length floating point number
Short format g
Format length g
Format hexadecimal 16 radix
Format bank fixed-point currency form
Format rat decimal fraction representation
Format++,-,space
Compressed format compressed space
Loose formats include spaces and blank lines.
Format length 15 word length fixed point
Format short e 5 word length floating point number
Format E Long 15 word length floating point number
Short format g
Format length g
Format hexadecimal 16 radix
Format bank fixed-point currency form
Format rat decimal fraction representation
Format++,-,space
Compressed format compressed space
Loose formats include spaces and blank lines.
Of course, you can also modify the system default setting format without the format command, file->; Preferences-> Command window-> Text display.
If you want to get a score, you can use the rats () function.
If you want to get the root sign, you must use the symbol. Of course, the use of symbols is omnipotent. For example:
A= 1/3 gives 0.33333.
Mouse (a) gets 1/3.
A='sqrt(3)' to get sqrt(3), but this is a character type, which can be converted into a numerical type by using eval(a) or str2num(a).
But no matter what output format Matlab uses, the accuracy of variables in the system kernel is always accurate (as accurate as possible). Unless you artificially change its calculation accuracy. We can illustrate this problem with a simple example: for example, a= 1/3 shows 0.33333333.
A=a*3 gives 1 (not 0.999999999).
It is impossible to get 1 in many other programming languages. This shows that Matlab will not lose the user's calculation information (including intermediate results) in the calculation process.