how to remove last zero from number in matlab -
if set variable in matlab, var1 = 2.111, after running script, matlab returns var1 = 2.1110. want matlab return original number, no trailing zero. know how this. in advance.
by default matlab displays results in short fixed decimal format, 4 digits after decimal point. can change various other format such as:
long
long fixed decimal format, 15 digits after decimal point double values, , 7 digits after decimal point single values. 3.141592653589793
shorte
short scientific notation, 4 digits after decimal point. integer-valued floating-point numbers maximum of 9 digits not display in scientific notation. 3.1416e+00
longe
long scientific notation, 15 digits after decimal point double values, , 7 digits after decimal point single values. integer-valued floating-point numbers maximum of 9 digits not display in scientific notation. 3.141592653589793e+00
shortg
more compact of short fixed decimal or scientific notation, 5 digits. 3.1416
longg
more compact of long fixed decimal or scientific notation, 15 digits double values, , 7 digits single values. 3.14159265358979
shorteng
short engineering notation, 4 digits after decimal point, , exponent multiple of 3. 3.1416e+000
longeng
long engineering notation, 15 significant digits, , exponent multiple of 3. 3.14159265358979e+000
however don't think other options available. if absolutely want remove zeros have cast result in string , remove trailing 0 characters , display result string , not number.
Comments
Post a Comment