Tag Archives: gist

გრაფიკთა მიმდევრობის avi ვიდეო-ფაილად შენახვა MATLAB-ში

სალამი ყველას 🙂

დავწერე პატარა აღწერამ თუ როგორ ხდება ეს. უფრო ჩემთვის, არ დამავიწყდეს. იმედია ვინმესაც გამოადგება 😉

% ======================================
% File: ani2avi
% Date: 1.Nov.2012
% Purpose: Saving a sequence of plots into avi file
% Author: Giorgi Maghlakelidze
% ======================================
clc; clear all; close all
% ===[ Example ] =======================
t = 0:1/30:2*pi; % Time in seconds
sint = sin(t); % Sine as a function of time
% ======================================
filename = 'movie.avi'; % Set movie filename
movie = avifile(filename,'FPS',30); % Create a avifile object called 'movie' with 30 fps
fig = figure; % Record the handle of figure
for i = 1:length(t)
plot(t, sint); % Plot the general path
hold on % Allow drawing of other objects
plot(t(i), sint(i), 'or') % Plot state of sin function at current time
hold off % This means the next plot replace current one
axis([t(1) t(end) -1 1]); % Fix the boundaries of view, so that it doesn't change from graph to graph
F = getframe(fig); % Record current drawing, use 'getframe(gca)' to record only central area
movie = addframe(movie,F); % Add saved frame to the movie
movie = close(movie) % Once all the frames are recorded, finalize the file and print info