From: didi mimi on
hi
I tried to run the code from the matlab help in the section of avifile.

t = linspace(0,2.5*pi,40);
fact = 10*sin(t);
fig=figure;
aviobj = avifile('example.avi')
[x,y,z] = peaks;
for k=1:length(fact)
h = surf(x,y,fact(k)*z);
axis([-3 3 -3 3 -80 80])
axis off
caxis([-90 90])
F = getframe(fig);
aviobj = addframe(aviobj,F);
end
close(fig)
aviobj = close(aviobj);

It is indeed open an avi file, but I can't run it using windows media player (and the player works on other avi files that were created with flash)

is it a bug in the help's example or am I am doing something wrong

thanlks
From: Leslie McBrayer on
> I tried to run the code from the matlab help in the section of avifile.
>
> t = linspace(0,2.5*pi,40);
> fact = 10*sin(t);
> fig=figure;
> aviobj = avifile('example.avi')
> [x,y,z] = peaks;
> for k=1:length(fact)
> h = surf(x,y,fact(k)*z);
> axis([-3 3 -3 3 -80 80])
> axis off
> caxis([-90 90])
> F = getframe(fig);
> aviobj = addframe(aviobj,F);
> end
> close(fig)
> aviobj = close(aviobj);
>
> It is indeed open an avi file, but I can't run it using windows media
> player (and the player works on other avi files that were created with
> flash)
>
> is it a bug in the help's example or am I am doing something wrong

By default on Windows systems, avifile creates a compressed AVI file using
the Indeo 5 codec -- but this codec is no longer shipped on many systems.
Try creating an uncompressed AVI file:

aviobj = avifile('example.avi','compression','None');


From: didi mimi on
thank you, now it works fine.
From: Michael Giacomelli on
"didi mimi" <ariel_gold(a)walla.com> wrote in message <hjnf78$fv2$1(a)fred.mathworks.com>...
> thank you, now it works fine.

The matlab examples and documentation for AVI file are badly out of date. They don't even work on Win64 bit matlab due to default codec not running on 64 Windows. I filed a bug report with mathworks, so hopefully they'll correct it in 2010a.
From: Davis on
"didi mimi" <ariel_gold(a)walla.com> wrote in message <hjn4jq$hg6$1(a)fred.mathworks.com>...
> hi
> I tried to run the code from the matlab help in the section of avifile.
>
> t = linspace(0,2.5*pi,40);
> fact = 10*sin(t);
> fig=figure;
> aviobj = avifile('example.avi')
> [x,y,z] = peaks;
> for k=1:length(fact)
> h = surf(x,y,fact(k)*z);
> axis([-3 3 -3 3 -80 80])
> axis off
> caxis([-90 90])
> F = getframe(fig);
> aviobj = addframe(aviobj,F);
> end
> close(fig)
> aviobj = close(aviobj);
>
> It is indeed open an avi file, but I can't run it using windows media player (and the player works on other avi files that were created with flash)
>
> is it a bug in the help's example or am I am doing something wrong
>
> thanlks

I'm having a similar problem. Everything worked fine under 2007a in Vista32 but when I upgraded to 2009b it broke. It doesn't appear to be a problem with the compressor, since saving in uncompressed format didn't fix it. Only the first frame gets saved and the rest of the frames in the clip are the same as the first. Further, the frame that gets captured is semitransparent, so that the underlying windows show through. It appears to be problem with perhaps both getframe() and addframe().