Capture frames from 3D comet plot to make a movie
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I am looking to capture frames from a comet plot and then stitch the frames together to form a movie. Can someone please help me?
Here is what I tried. I opened up comet3.m and I added the line 'M(iframe) = getframe' after the 'drawnow' command in the grow the body, primary loop, and clean up the tail segments. iframe is a counter that I increment inside the for loop in those segments. What happens is that the comet plot displays only the current position of the comet and does not display the previous pathways (which is undesirable).
Any help will be greatly appreciated.
Thanks
0 个评论
采纳的回答
Kevin Claytor
2012-8-30
I had the same problem as you when modifying comet3. I got the movie working, but the process eliminates the immeadiate tail of the comet, but leaves the track, so I think it will work for you. I wasn't quite clear on all the k, p and m indexing in comet3, so I reduced it to (removing the "%grow the body" and "%clean up the tail" sections;
function M = comet3(varargin)
...SNIP...
iter = 1;
% Primary loop
m = length(x);
for i = 1:m
set(head,'xdata',x(i),'ydata',y(i),'zdata',z(i))
set(tail,'xdata',x(1:i),'ydata',y(1:i),'zdata',z(1:i))
drawnow
M(iter) = getframe;
iter = iter+1;
end
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!