Printing and Plotting after each loop
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 4 Mär. 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 Kommentare
Walter Roberson
am 4 Mär. 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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Other Formats finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!