How do I save a video with subplot?

조회 수: 4 (최근 30일)
Andrea Zuccotto
Andrea Zuccotto 2017년 2월 26일
답변: Prashant Arora 2017년 3월 8일
Hi everyone!
I have a sequence of frames on which I have plotted two arrays in order to show the behaviour of a scenario using the subplot function. I used the videowriter function to save only the video, and so far I had no problems. Now I'd like to save a video with the two arrays displayed with subplot but it doesn' t seem to work. Is there some other function that I can use to show all my plots in the video? It seems that I may use the getframe function but so far i didn't understand how to deal with it. any other suggestions?

답변 (1개)

Prashant Arora
Prashant Arora 2017년 3월 8일
Hi Andrea,
You can refer to the code below to get started on getframe and video writer.
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);

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by