Printing and Plotting after each loop
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a for loop where the structure is like this
A=[1 3 4;3 5 6]
U=[]
for i=1:10
...
U=A
end
how would I print U matirx after each loop on the text file beacause when I am doing that only the matirx in the 10th iteration loop prints and how would I be able to plot all those iterations in one figure using point clouds?
댓글 수: 3
채택된 답변
Walter Roberson
2021년 3월 4일
A=[1 3 4;3 5 6]
U=[]
for i=1:10
A = A * 2;
U=A;
dlmwrite('U.txt', U, '-append')
end
!cat U.txt
댓글 수: 3
Walter Roberson
2021년 3월 4일
A=[1 3 4;3 5 6]
U=[]
for i=1:10
A = A * 2;
U=A;
dlmwrite('U.txt', U, '-append')
dlmwrite('U.txt', ' ', '-append')
end
!cat U.txt
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Other Formats에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!