Making a video for 1000 time-steps
30 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Neda
le 10 Déc 2024 à 1:06
Commenté : Neda
le 11 Déc 2024 à 1:08
Hi Matlab Team,
The output of my code is the movement of cells in 1000 time-steps, I arrange the code such that I can see the result in each time-step. Now, I want to create a video from all the frames. Would you please let me know, how can I do this?
Thank you !!!
0 commentaires
Réponse acceptée
Walter Roberson
le 10 Déc 2024 à 1:57
writerObj = VideoWriter('OutputFileNameGoesHere.avi');
ax = gca;
oldsize = [0 0];
for timestep = 1 : 1000
%do appropriate plotting here
%...
F = getframe(ax);
if timestep == 1
oldsize = [size(F.cdata,1), size(F.cdata,2)];
else
F.cdata = imresize(F.cdata, oldsize);
end
writeVideo(writerObj, F);
end
close(writerObj);
3 commentaires
Voss
le 10 Déc 2024 à 23:39
writerObj = VideoWriter('OutputFileNameGoesHere.avi');
open(writerObj);
% then the rest of the code is the same ...
ax = gca;
% etc.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Image Acquisition Toolbox Supported Hardware dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!