フィルターのクリア

Fprintf values in an ordered manner

2 ビュー (過去 30 日間)
Fuwad Abdul Muyeed
Fuwad Abdul Muyeed 2021 年 4 月 8 日
Hi. I have two arrays with different values. x=[0.1,5,10] and y=[400,500,600]. When I print out the values with the following command,
fprintf(' %g %10f\n',[x(:),y(:)].')
I get
0.1 400
5 500
10 600
But I want in an ordered manner such that the right column is indented in one straight vertical column.
0.1 400
5 500
10 600
Could anyone kindly please help me achieve this?

採用された回答

Walter Roberson
Walter Roberson 2021 年 4 月 9 日
x=[0.1,5,10]
x = 1×3
0.1000 5.0000 10.0000
y=[400,500,600]
y = 1×3
400 500 600
fprintf('%-10g %-10f\n',[x(:),y(:)].')
0.1 400.000000 5 500.000000 10 600.000000
  1 件のコメント
Fuwad Abdul Muyeed
Fuwad Abdul Muyeed 2021 年 4 月 9 日
Thank you very much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by