필터 지우기
필터 지우기

movie2avi - I am getting a blank movie, but no errors.

조회 수: 5 (최근 30일)
Matthew
Matthew 2013년 2월 18일
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

답변 (2개)

Walter Roberson
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

Matthew
Matthew 2013년 2월 21일
Thanks for the help but it's still giving me weird results.
I ran the correction and it still isn't giving me a movie. When I run movie(M) the movie is the axis with whatever is on my desktop behind the figure.
  댓글 수: 1
Image Analyst
Image Analyst 2013년 2월 21일
All movies, or just one particular movie? Could you upload the movie somewhere?

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

카테고리

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