How to create jpg file from .mat for making video( AVI.fomat)
    4 次查看(过去 30 天)
  
       显示 更早的评论
    
I have 2000 .mat file(524*424 matrix for each .mat). Now i want to create each .mat to jpeg file to build AVI video. Could anyone guide me to do this? (i used matlab 2017 )
0 个评论
采纳的回答
  KSSV
      
      
 2018-5-21
        files = dir('*.mat') ;
N = length(files) ;
% create the video writer with 1 fps
writerObj = VideoWriter('myVideo.avi');
writerObj.FrameRate = 10;
% open the video writer
open(writerObj);
for i = 1:N
    S = load(files(i).name) ;
    A = S.A ;   % let A be the data stored in .mat file 
    imshow(A)     
    drawnow
% write the frames to the video
    F = getframe(gcf) ;
  writeVideo(writerObj, F);
end
% close the writer object
close(writerObj);
fprintf('Sucessfully generated the video\n')
2 个评论
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

