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?
참고 항목
카테고리
Help Center 및 File Exchange에서 Animation에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!