How to make a video of two plots rather than one
    9 views (last 30 days)
  
       Show older comments
    
    raheem mian
 on 14 Nov 2019
  
    
    
    
    
    Answered: Prabhan Purwar
    
 on 21 Nov 2019
            I am iterating frame by frame between two different volumes of images, I want to make a video so that there is a side by side comparison. This is what I have to create the plots, now I want to save it into one video.
for i = range
    figure(fref)
    imagesc(squeeze(log(abs(vol1(i,:,:)))), [0 6]);
    colormap(gray);
    title(sprintf('frame %i, ogvol %i', i, volname));
    figure(ftar)
    imagesc(squeeze(log(abs(vol2(i,:,:)))), [0 6]);
    colormap(gray);
    title(sprintf('frame %i, changedvol %i', i, volname));
    if i == 150
        pause;
    else
        pause(0.1);
    end
end
0 Comments
Accepted Answer
  Prabhan Purwar
    
 on 21 Nov 2019
        Hi,
Make use of subplot() to get side by side comparison, as illustrated in the code below.
h = figure;
subplot(2,1,2);
plot(1:10);
subplot(2,1,1);
plot(5:15);
F = getframe(h);
v = VideoWriter('myFile.avi');
open(v);
writeVideo(v,F.cdata)
close(v);
Refer to the following link for further information: 
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
