Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Table format issue with fprintf command

1 回表示 (過去 30 日間)
Logan Keener
Logan Keener 2019 年 11 月 1 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I run this code and the tables read left to right instead of running vertically
r=0:0.25:3;
S=4*pi*r.^2;
V=(4/3)*pi*r.^3;
disp(' Radius, r(in) Surface Area, S(in^2) Volume, V(in^3)')
fprintf('%9.2f in%9.2f in^2%9.2f in^3\n',[r',S',V']);
Radius, r(in) Surface Area, S(in^2) Volume, V(in^3)
0.00 in 0.25 in^2 0.50 in^3
0.75 in 1.00 in^2 1.25 in^3
1.50 in 1.75 in^2 2.00 in^3
2.25 in 2.50 in^2 2.75 in^3
3.00 in 0.00 in^2 0.79 in^3
3.14 in 7.07 in^2 12.57 in^3
19.63 in 28.27 in^2 38.48 in^3
50.27 in 63.62 in^2 78.54 in^3
95.03 in 113.10 in^2 0.00 in^3
0.07 in 0.52 in^2 1.77 in^3
4.19 in 8.18 in^2 14.14 in^3
22.45 in 33.51 in^2 47.71 in^3
65.45 in 87.11 in^2 113.10 in^3
The left column is supposed to be 0, .25, .5, etc. but instead it goes to the left column, does anyone know how to fix this?

回答 (0 件)

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by