Info

This question is closed. Reopen it to edit or answer.

How does one accurately plot a string so that it can be used as a headers for a matrix?

1 view (last 30 days)
This is what I have so far
meanvalues = [10 65;20 66;50 67;100 68;200 69]';
fprintf ' T(K) K(1/min) \n';
fprintf ('%f %e \n', meanvalues)
Is there a way to automatically format T(K) and K(1/min) above the two columns without having to keep putting in spaces and checking the result.

Answers (1)

Image Analyst
Image Analyst on 15 Feb 2015
You can specify a field width for f and e in your format string. Then it will be right for all size numbers:
meanvalues = [10 65;20 66;50 67;100 68;200 69]';
fprintf ' T(K) K(1/min) \n';
fprintf ('%10.1f %10.2e \n', meanvalues)
T(K) K(1/min)
10.0 6.50e+01
20.0 6.60e+01
50.0 6.70e+01
100.0 6.80e+01
200.0 6.90e+01

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!