필터 지우기
필터 지우기

how to save a video of an animated graph

조회 수: 18 (최근 30일)
Iman Ramzanpoor
Iman Ramzanpoor 2021년 6월 14일
편집: Aghamarsh Varanasi 2021년 6월 17일
Hi i did write a code for saving animated graph as a video but do not save it.
please help me out to find out where did i make a mistake. thanks
the code i did wite is as follow;
t1 = Time;
y = Pitch;
for t = 1:length(t1)
plot(t1(1:t),y(1:t));
title ('Pitch');
xlabel ('Time(s)');
ylabel ('Amplitude(deg)');
drawnow;
end
writeAnimation(figure,'loop.gif','LoopCount',1)

답변 (1개)

Aghamarsh Varanasi
Aghamarsh Varanasi 2021년 6월 17일
편집: Aghamarsh Varanasi 2021년 6월 17일
Hi Imran,
There are two ways in which you can achieve this and it mainly depends on the variables 't1' and 'y'.
  1. If 't1' and 'y' are vector of integers and you want to animate plotting each point in the figure, you can follow the procedure in this community post to achieve this. Basically you need to capture each plot as a frame and save all these frames as a gif.
  2. If the variable 't1' is a symbolic variable that denotes time and variable 'y' can be sybolically represented as a function of 't1', you can create a fanimator object and write the animation using the writeAnimation function. For reference, you can check the examples given in the documentation page of writeAnimation function.
Hope this helps

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by