Printing and Plotting after each loop
1 view (last 30 days)
Show older comments
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 Comments
Accepted Answer
Walter Roberson
on 4 Mar 2021
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 Comments
Walter Roberson
on 4 Mar 2021
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
More Answers (0)
See Also
Categories
Find more on Other Formats in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!