B = [8.8 7.7; 8800 7700] fprintf(1, 'X is %6.2f meters or %8.3f mm\n', 9.9, 9900, B)
These commands display
X is 9.90 meters or 9900.000 mm X is 8.80 meters or 8800.000 mm X is 7.70 meters or 7700.000 mm
However, you may only want to print a vector. The following examples show how to use frpintf with a vector.
a =1:3; fprintf('%g', a) fprintf('%g|', a) fprintf('%2.2f,', a)The commands above give
123 1|2|3| 1.00,2.00,3.00,Note that how the numbers are separated.
No comments:
Post a Comment