How do I save a video with subplot?

3 ビュー (過去 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 Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by