Need play/pause buttons for my animation!

조회 수: 23 (최근 30일)
Nathan
Nathan 2011년 7월 18일
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.

답변 (2개)

Walter Roberson
Walter Roberson 2011년 7월 18일
  댓글 수: 1
Nathan
Nathan 2011년 7월 18일
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.

댓글을 달려면 로그인하십시오.


Patrick Kalita
Patrick Kalita 2011년 7월 20일
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
Nathan
Nathan 2011년 7월 20일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by