Borrar filtros
Borrar filtros

How can I store video of my for loop code?

12 visualizaciones (últimos 30 días)
J Kwon
J Kwon el 28 de Ag. de 2022
Comentada: Abderrahim. B el 28 de Ag. de 2022
Hello, I am beginner for Matlab and use Matlab 2014a.
I made my code which is consisted of for loop statement.
So I want to store the variation of my plot into the avi file.
Could you help me?
  1 comentario
Abderrahim. B
Abderrahim. B el 28 de Ag. de 2022
Hi!
Share what you have tried to write as code as well as the plots you want to 'store' as an avi .
Thanks

Iniciar sesión para comentar.

Respuesta aceptada

Abderrahim. B
Abderrahim. B el 28 de Ag. de 2022
I ve written the below code that you can refer to.
clear
t = 0:1/100:1-1/100;
vObj = VideoWriter('AnimPPlot.avi');
open(vObj);
for ii = 1:length(t)
plot(t, exp(-ii*t))
pltHandle = gcf ;
im = frame2im(getframe( pltHandle )) ;
writeVideo(vObj, im); % Write avi video
end
close(vObj)
Hope this helps
  2 comentarios
J Kwon
J Kwon el 28 de Ag. de 2022
Thank you for your kindness Issa!
I accoplished my problem thanks to you.
Abderrahim. B
Abderrahim. B el 28 de Ag. de 2022
You are welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Images en Help Center y File Exchange.

Productos


Versión

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by