How do I convert the frames I've generated Matlab to avi format

3 views (last 30 days)
How do I convert the frames/movie in this program to avi format so that I can show it in a power point presentation
y_max=50.0;
y_min=-50.0;
%F= (rand(20,10).*10);
N=300;
RandForce = 1030*rand(N,1) .* sign(randn(N,1));
k= 20.5;
y=RandForce./k;
%r=x_min+(x_max-x_min).*rand(n,1);
y(y_min > y | y > y_max) = 0;
figure(1)
plot(y); % Graphs the Plot
xlabel('frames');
ylabel('Random Positions');
figure (2)
scatter( 1:length(y), y, 90, [0 0 0], 'filled' );
xlabel('frames');
ylabel('Random Positions');
figure('Position', [300 300 300 300])
axlim=900;
aylim=80;
for i = 1:length(y)
%fprintf('Frame: %03d\n', i)
b=y;
plot(b,'.','MarkerSize',50)
axis([-axlim axlim -aylim aylim]);
% axis off
end
randommov = figure('Position', [300 300 300 300])
h=randommov;
set(h,'Position',[300 300 300 300])
set(h,'NextPlot','replacechildren')%Make sure each frame
%of the movie is the same size
axlim=900;
aylim=80;
N=10;
count=1;
M=moviein(N);
for j = 1:N
%fprintf('Frame: %03d\n', i)
b=y;
plot(b(j),'.','MarkerSize',50)
axis([-axlim axlim -aylim aylim]);
title('Microsphere');
S1=sprintf('Frame: %03d\n', j);
text(6,.5,S1)
titlestr = sprintf('Frame: %03d', k); % our title will change
%fprintf('Frame %d\n', k); % print loop counter68.
pause(0.1);
% axis off
M(:,j) = getframe(randommov);
M(count)=getframe(h);
count=count+1;
%movie(M)
end

Accepted Answer

Walter Roberson
Walter Roberson on 28 Jan 2013
If necessary if you have an older MATLAB, use avifile. However, it is better to use VideoWriter if you have it.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!