Animated data-tip or xline?
Mostrar comentarios más antiguos
Hello,
I am looking to create an animation of a datatip or a vertical line moving across a plot which has arleady been made. I need to be able to control the framerate of the animation (or, the rate at which the line/datatip moves from one x-value to the next). I then (ideally) need to be able to export this animation as a movie. I've checked the documentation for this and it does not seem intuitive at all. If anyone could provide any assistance, it would be much appreciated!
Here is my attempt so far at making a vertical line move across a simple plot at a rate of 4 frames/second:
x=[1:20]
y=sin(x)
L = xline(0)
a=tic
for i = 1:length(x)
delete(L)
L = xline(i)
b = toc(a)
if b>1/4
drawnow
a=tic
end
end
As you probably guessed, it does not work as intended at all. The example code I drew from is here, under "control animation speed."
Any help is much appreciated!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Animation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!