function animate_plot(filename) % animate_plot.m % animates a 2D x-y plot and saves it to an AVI file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % define animation window - DO NOT MODIFY rect=get(gcf,'Position'); rect(1:2)=[1 1]; % define color scheme - DO NOT MODIFY colordef black; set(gcf,'color',[0 0 0]); % imports data and headings from abaqus.rpt file A=importAbaqus(filename); % sets x and y data % change the number in parenthese to grab a different column of data from the data file % scale the data if necessary... i.e. /1000 converts data to kN from N x=A.data(:,1); y=A.data(:,2)/1e6; % gets min and max values from the data vectors in order to scale the axis % alternately, you could give a specific value, i.e. minx=0 minx=min(x); maxx=max(x); miny=min(y); maxy=max(y); % sets frame frequency interval, i.e. the number of new points to add to a new frame % frameint = 1 : create a frame for every data point % frameint = 5 : create a frame for every fifth point frameint=30; % number of frames desired - DO NOT MODIFY tmax = length(x)/frameint; % loop for creating animation frames - DO NOT MODIFY for t=1:tmax % calculate last data point to plot for frame - DO NOT MODIFY plotend=((t-1)*frameint)+1; % plot data - DO NOT MODIFY (except for LineWidth) a=x(1:plotend); b=y(1:plotend); plot(a,b,'LineWidth',2); % set various axis properties set(gca,'LineWidth',1,'XColor','white','YColor','white') set(gca,'FontSize',14,'FontWeight','bold') set(gca,'TickLength',[.02 .02]) set(gca,'XMinorTick','on','YMinorTick','on') axis([minx maxx miny maxy]); % labels xlabel('Depth, \mum','FontSize',16,'Color','white'); ylabel('Force, N','FontSize',16,'Color','white'); %title('Displacement vs Load','FontSize',16,'Color','white'); % record frame - DO NOT MODIFY M(:,t)=getframe(gcf,rect); end % exported movie name moviename='mymovie.avi'; % convert movie to avi file and save - DO NOT MODIFY movie2avi(M,moviename,'compression','none'); aviinfo(moviename)