plot data into a while lopp without storing the data
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
mikel lasa
el 20 de En. de 2022
Editada: mikel lasa
el 26 de En. de 2022
Hello,
I have a while loop that iterates 2500 times and in each loop I get 3 arrays of 6x1. I dont want to store the data for each iteration, only plot the actual data and keep updating the same plot... is that possible??
Thanks in advance
2 comentarios
Respuesta aceptada
Voss
el 20 de En. de 2022
If you want each new iteration to replace previously plotted results:
i = 0
while i < 2500
% do stuff
hold off
plot(x)
hold on
plot(y)
plot(z)
drawnow()
i = i+1;
end
If you want each new iteration to add to the previously plotted results:
hold on
i = 0
while i < 2500
% do stuff
plot(x)
plot(y)
plot(z)
drawnow()
i = i+1;
end
3 comentarios
Voss
el 21 de En. de 2022
The line:
plot(i,qs(1,1))
plots one point. What happens if you replace that with this:
plot(qs(:,1))
or perhaps this:
plot(i*ones(n,1),qs(:,1))
Try those and see if it's more like what you want.
(And if you attach the necessary mat files, I'll be able to run the code and provide more useful help.)
Más respuestas (0)
Ver también
Categorías
Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!