Print x as a decimal integer and y both as a float with 6 digits after the decimal point and in scientific notation with 6 digits after the decimal point. If you are only concerned with displaying the results with two digits after the decimal, then you can use fprintf There's insufficient room allowed even in the second column for full precision of a double, however, which is 15-16 decimal digits as you've only left room for 12 including the decimal point so only 11 digits maximum and that presumes the … Is there any way to print values to more decimal places using fprintf? How can I display a table with specific number of decimal places in ... The 12 characters for the string include the e+00 or e-00 (or e+000 or e-000 on WindowsTM) ME 350: The Matlab fprintf Command page 9 Matlab did exactly what you asked it to...you told it to write the first column with only two decimals and the second with eight. You were told what function to use, the next step is to read its documentation and try some of its examples. age = 35; height = 6.1; fprintf ('My age is %f and height is %f. In the above code, \t is used to give a tab space, and \n is used to move the cursor to a new line. How to fprintf of the array of floating-point numbers Just take a look at the very basic example below about the use of the ‘fprintf ()’ command in Matlab®. The corresponding part of the number of digits to the right of the decimal point (eg. fprintf - math.clemson.edu It is then cycled in a similar manner, without reinitializing, through any additional matrix arguments. 0. Vote. If your output is to something else, then use a specific format string and write to file or use the COM stuff and stuff directly into Word. As far as I can tell, there is no simple usage of *printf in C or MATLAB to correctly print to n sigfigs for all possible values, but %#.3g gets the closest, I think, and is not technically wrong with the trailing decimal with out any digits, but can be confusing when used in a sentence as it looks like a period.