Hi all,
I have the following code to create a gif from my data plots and I would like to do this with subplots for other parameters. The code is a bit messy but I am not sure how to work the handles for the subplots to have the playback synchronized for each plot:
DATASET1 = tower_pres_allyrs(1:100,1);DATASET2 = tower_pres_allyrs(1:100,2);h = plot(NaN,NaN); axis([min(DATASET1) max(DATASET1) min(DATASET2) max(DATASET2)]); for ii = 1:length(DATASET1) pause(0.1) set(h, 'XData', DATASET1(1:ii), 'YData', DATASET2(1:ii)); drawnow frame = getframe(1); im = frame2im(frame); [imind,cm] = rgb2ind(im,256); if ii == 1; imwrite(imind,cm,'filename.gif','gif','Loopcount',inf,'DelayTime',0.01); else imwrite(imind,cm,'filename.gif','gif','WriteMode','append','DelayTime',0.01); endend
Thanks!
Best Answer