Need play/pause buttons for my animation!

26 visualizaciones (últimos 30 días)
Nathan
Nathan el 18 de Jul. de 2011
I have recently and successfully implemented an animation where I have the x and y axes representing the literal layout of the sensors in the ground. Then, the z axis is the acceleration reading for each sensor at the corresponding (x,y) point. I plotted it using surf/bar3. I made it an animation by using a for loop that updates the z values of each sensor, then replots the figure and I use M(i) = getframe with each iteration of the loop to update the movie.
Now, where this animation falls short is the lack of play/pause/stop buttons. This is incredibly essential because the whole reason I am constructing this animation tool is to be able to provide a quick and easy way to visualize the data we are collecting as a sort of sanity check, and I've been told that being able to pause and resume at will is pretty essential to this whole animation.
So far, the only way I've found that you can incorporate these play/pause/stop/ff/rewind buttons in Matlab in your figure is through the implay function for image sequences/AVI files. http://www.mathworks.com/help/toolbox/images/ref/implay.html Unfortunately, converting each of my generated figures for each unit of time to a jpeg would use up way too much space considering the ridiculous amounts of jpegs that would have to be generated.
BOTTOMLINE: Does anyone know of any ways i can incorporate play/pause features into my animation besides the implay function?
Thanks in advance all.

Respuestas (2)

Walter Roberson
Walter Roberson el 18 de Jul. de 2011
  1 comentario
Nathan
Nathan el 18 de Jul. de 2011
Yes, thanks I saw it! Someone suggested that I simply post a new question because the last one was a little unorganized, so I did. I will try out your solution now and let you know shortly. Thanks again.

Iniciar sesión para comentar.


Patrick Kalita
Patrick Kalita el 20 de Jul. de 2011
I'm not quite sure I understand your objection to using implay. If you have a movie structure generated with getframe, you can pass that directly to implay -- no converting necessary. For example:
% Generate the movie structure
figure('Renderer', 'zbuffer')
Z = peaks; surf(Z);
axis tight
set(gca,'NextPlot','replacechildren');
F(20) = struct('cdata',[],'colormap',[]);
for j = 1:20
surf(.01+sin(2*pi*j/20)*Z,Z)
F(j) = getframe;
end
% Play with IMPLAY
implay(F)
  1 comentario
Nathan
Nathan el 20 de Jul. de 2011
Yep, this is pretty much what I ended up doing. I thought implay could only be used for image sequences, but I was misinformed. This works great though, despite how long it takes to make the movie itself, but it does the job

Iniciar sesión para comentar.

Categorías

Más información sobre Animation 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!

Translated by