movie2avi - I am getting a blank movie, but no errors.
5 次查看(过去 30 天)
显示 更早的评论
When I make the movie, it plays fine while I'm running the code. When I run movie(M), it gives me a weird off-center axis and movie2avi(M,'somename.avi') is just a blank screen of the proper time.
Z = peaks;
surf(Z);
axis tight
hfig=figure;
xlabel('x');
ylabel('y');
zlabel('z');
xlim([0 60]);
ylim([0 60]);
zlim([-10 10]);
M(1)=getframe(hfig);
for k = 2:200
surf(cos(2*pi*k/50)*Z,Z)
zlim([-10 10]);
M(k) = getframe(hfig);
end
Any help would be great. Thanks
0 个评论
回答(2 个)
Walter Roberson
2013-2-19
You might need to add a pause() for a short time before the getframe. You are not supposed to need that, but in practice some people need it.
Also, before the first getframe() you should
hold all
and change your graphics code slightly. Easiest for me to show you:
Z = peaks;
hfig=figure;
oldsurf = surf(Z);
axis tight
xlabel('x');
ylabel('y');
zlabel('z');
xlim([0 60]);
ylim([0 60]);
zlim([-10 10]);
hold all
pause(0.1)
M(1)=getframe(hfig);
for k = 2:200
delete(oldsurf);
oldsurf = surf(cos(2*pi*k/50)*Z,Z);
pause(0.1)
M(k) = getframe(hfig);
end
hold off
0 个评论
Matthew
2013-2-21
1 个评论
Image Analyst
2013-2-21
All movies, or just one particular movie? Could you upload the movie somewhere?
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!