To be or not to be

1 visualización (últimos 30 días)
Lard Guard
Lard Guard el 3 de Mayo de 2018
Comentada: Rena Berman el 12 de Dic. de 2019
im trying to make a code to show the movements of particles on a graph. whenever the graph is plotted the particles dont move. How do I make the plots move over time?
  3 comentarios
Stephen23
Stephen23 el 15 de Nov. de 2019
Original Question by Joseph Stocken "Trying to make an animation of particle movement":
im trying to make a code to show the movements of particles on a graph. whenever the graph is plotted the particles dont move. How do I make the plots move over time?
Képkivágás.PNG
Rena Berman
Rena Berman el 12 de Dic. de 2019
(Answers Dev) Restored edit

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 3 de Mayo de 2018
You need to add a drawnow() or pause() after the scatter.
It is recommended that instead of using scatter() inside the loop, that instead you scatter() once before the loop and record the handle that is returned. Then inside the loop, set() the XData and YData properties of the handle to reflect the new locations: that is more efficient than rebuilding the axes each time the way you are now.

Más respuestas (0)

Categorías

Más información sobre Graphics Performance en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by