Matlab coding issue with "fprintf" function

9 ビュー (過去 30 日間)
Adam Scott
Adam Scott 2021 年 2 月 4 日
コメント済み: Star Strider 2021 年 2 月 5 日
Hi, i am trying to print the output of my code into columns and now the results print but not in their respective columns. It prints from the first value of my first variable to its last, then the 1st value of my 2nd variable to its last, etc. I want them to print in their respective columns like the example below.
x v a
-------------
x1 v1 a1
x2 v2 a2
x3 v3 a3
but what i obtain is
x v a
-------------
x1 x2 x3
v1 v2 v3
a1 a2 a3
this is my code

採用された回答

Star Strider
Star Strider 2021 年 2 月 4 日
My version of MATLAB will not run images of code, only actual code, and I have no desire to type all of that in.
See if:
fprintf('%-4.2f %-42.f %-4.2f %-4.2f', output.')
does what you want. (Note the transposition: (.') for complex data or (') otherwise.)
  11 件のコメント
Adam Scott
Adam Scott 2021 年 2 月 5 日
Your solution is working. The error was on my side.
Thank you for your time and support. It is really appreciated.
Star Strider
Star Strider 2021 年 2 月 5 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Identification についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by