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

5 Ansichten (letzte 30 Tage)
Matthew
Matthew am 18 Feb. 2013
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

Antworten (2)

Walter Roberson
Walter Roberson am 19 Feb. 2013
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 am 21 Feb. 2013
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 Kommentar
Image Analyst
Image Analyst am 21 Feb. 2013
All movies, or just one particular movie? Could you upload the movie somewhere?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Animation finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by