フィルターのクリア

How to convert fprintf from single row to multiple rows?

2 ビュー (過去 30 日間)
Christoppe
Christoppe 2022 年 6 月 25 日
コメント済み: Star Strider 2022 年 6 月 25 日
Hi! I just started using Matlab a couple of days ago. How can I convert this single row into multiple rows?

採用された回答

Star Strider
Star Strider 2022 年 6 月 25 日
There is not enough of the code provided to know what the problem is (and images of code are never appropriate, since actual code that can be copied, pasted, and run is always preferable).
That code should be writing the results 1000 times, so whatever is causing it not to do so is likely ‘over the horizon’ and out of sight here.
  5 件のコメント
Christoppe
Christoppe 2022 年 6 月 25 日
Hi! I appreiciate the information you have shared with me, and I appreciate your prompt reply.
Star Strider
Star Strider 2022 年 6 月 25 日
As always, my pleasure!
I found it somewhat surprising that the fprintf statement was the problem. I learned something from this.

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

その他の回答 (1 件)

Adam Danz
Adam Danz 2022 年 6 月 25 日
I assume you want to show each numeric value in a new line. To do that, add a new line control character where you want to insert a new line,
fprintf('%11.5f\n%11.5f\n%11.5f\n%11.5f\n%11.5f\n', rand(1,6))
0.50328 0.90133 0.47589 0.81838 0.27507 0.93488
  6 件のコメント
Christoppe
Christoppe 2022 年 6 月 25 日
Enter function:
x^3 - 4*x^2 + x - 10
Enter the first initial guess:
3
Enter the second initial guess:
4
Enter absolute error:
0.0001
Christoppe
Christoppe 2022 年 6 月 25 日
the problem are the answers after 5 iterations they appeared in a single row. what i wanted is like a multiple rows.....
1 x0 x1 answer answer Ea
2 x0 x1 answer answer Ea
3 x0 x1 answer answer Ea
4 x0 x1 answer answer Ea.
5 x0 x1 answer answer Ea

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

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by