How to convert fprintf from single row to multiple rows?
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi! I just started using Matlab a couple of days ago. How can I convert this single row into multiple rows?
댓글 수: 0
채택된 답변
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
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
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))
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!