making movies with avifile and addframe produces black screen in half of the movie

1 view (last 30 days)
Hello there!
I would very much appreciate some help with a movie I am making from my simulation results. Generally, the code is like this:
clear all; clc;
aviobj=avifile('movie.avi','fps',5);
img = figure();
ax = axes('parent',img);
hold(ax,'all');
set(ax,'XLim',[0 300]);
set(ax,'YLim',[0 300]);
for i=1:288
pl = plot(i,i,'parent',ax);
aviobj = addframe(aviobj,getframe(img));
delete(pl);
end
aviobj = close(aviobj);
close all;
Obviously, the pictures in it are more complex but this is the principle.
This works well, except: When looking at the movie, the second half of the movie is just a black screen.
What could be the problem here?
Thank you very much for your help!
Anna

Answers (0)

Community Treasure Hunt

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

Start Hunting!