Pause in sequnce of graphs for animation/video

7 views (last 30 days)
I was trying to write some plots at 1 frame for 5 second to a gif animation (with pause(5) and imwrite) and it was ok apart from the fact that animation is cycled. Trying to fix it, I applied VideoWriter, but for rate less than 1 frame per second it is only writing black screen for first seconds. I constructed a simplified example that you can run, and it still exhibits the same behavior:
clear;clc;clf;close all;
outputVideo = VideoWriter('testmovie.avi');
outputVideo.Quality = 100;
outputVideo.FrameRate = 0.2; % How many frames per second.
open(outputVideo);
for i = 1:10
clf;
plot(i*10:i*11, sin(i*10:i*11));
writeVideo(outputVideo, getframe(gcf));
end
close(gcf)
close(outputVideo);
How can I solve this problem with the black screen in the beginning? Or maybe that's a wrong way?

Answers (0)

Categories

Find more on Animation in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!