Make a movie from series of Fig file
Show older comments
Hello everyone
I have a series of .fig file as shown like this.

How I can create the video by MATLAB.
Thanks in advance
Answers (2)
Sudhakar Shinde
on 15 Oct 2020
Edited: Sudhakar Shinde
on 15 Oct 2020
Try VideoWriter
video = VideoWriter('Movie.avi');
open(video);
folder = 'D\Folder';
str = int2str(i);
for i=1:N
Image = strcat(folder,'\',int2str(i),'.fig');
I = imread(Image);
writeVideo(video,I);
end
close(video);
10 Comments
Trang Hu Jia
on 15 Oct 2020
Sudhakar Shinde
on 15 Oct 2020
Edited: Sudhakar Shinde
on 15 Oct 2020
can you try on command window and check if error observed or this is successful :
video = VideoWriter('Movie.avi')
Trang Hu Jia
on 15 Oct 2020
Sudhakar Shinde
on 15 Oct 2020
Edited: Sudhakar Shinde
on 15 Oct 2020
ok so where is the error ? Is this error during execution of writeVideo(video,I); ?
Trang Hu Jia
on 15 Oct 2020
Sudhakar Shinde
on 15 Oct 2020
Have you added path of your image folders in 'folder' variable
Trang Hu Jia
on 15 Oct 2020
Sudhakar Shinde
on 15 Oct 2020
Can you attach fig file example here
Trang Hu Jia
on 15 Oct 2020
Sudhakar Shinde
on 15 Oct 2020
Edited: Sudhakar Shinde
on 15 Oct 2020
fig file is not supported for imread. So it could not works. Check supported formats for imread by using command - 'imformats'.
One thought if there will not be any data loss , you can convert .fig to supported format and use above solution. But look for any kind of data loss during conversion.
Image Analyst
on 15 Oct 2020
0 votes
It's best not to save your screenshots out as .fig files. You should save them as PNG instead. Or just create the video directly from the axes on the figure as you change it. See attached demos.
Categories
Find more on Video Formats and Interfaces in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!