Exporting animation figure mat lab to power point.

20 views (last 30 days)
friet
friet on 21 Dec 2016
Answered: KSSV on 21 Dec 2016
I Have this animation figure in matlab. Can anyone help me how to easly export it to my powerpoint presentation where I can show my animation in the slide.
clear;close all;clc
slope_times = [0, 10, 20, 50];
slope = [1, 3, 5, 7]; %you need to recheck the initial slope
x = 0:10:100;
times = linspace(slope_times(1), slope_times(end));
m = interp1(slope_times, slope, times);
for k = 1 : length(times)
y = m(k) * x;
plot(x, y);
title( sprintf('t = %.1f', times(k)) );
hold all
pause( 0.5 );
end
hold off
Thanks

Answers (1)

KSSV
KSSV on 21 Dec 2016
YOu make your animation into a .gif file and import it into power point.
clc; clear all ;
clear;close all;clc
slope_times = [0, 10, 20, 50];
slope = [1, 3, 5, 7]; %you need to recheck the initial slope
x = 0:10:100;
times = linspace(slope_times(1), slope_times(end));
m = interp1(slope_times, slope, times);
figure(1)
filename = 'test.gif';
for k = 1 : length(times)
y = m(k) * x;
plot(x, y);
title( sprintf('t = %.1f', times(k)) );
hold all
pause( 0.5 );
frame = getframe(1);
im = frame2im(frame);
[imind,cm] = rgb2ind(im,256);
if k == 1;
imwrite(imind,cm,filename,'gif', 'Loopcount',inf);
else
imwrite(imind,cm,filename,'gif','WriteMode','append');
end
end
hold off

Categories

Find more on Animation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!