function n = saveaviseveral(s, filename) % N = PRINT(S) % % S: ... % % N: ... % % PRINT displays fronts saved in 'Curves'. ... if (nargin == 1) filename = 'Anim'; end; global x y n Fronts Curves = load('Curves'); CurveLengths = load('CurveLengths'); x = load('X'); y = load('Y'); Delta_x = x(2) - x(1); Delta_y = y(2) - y(1); LimitDistance = sqrt( Delta_x^2 + Delta_y^2 ); n = length(CurveLengths); Fronts = cell(n,1); count = 1; for i=1:n Fronts(i) = {Curves(count:count + CurveLengths(i) - 1, :)}; count = count + CurveLengths(i); end figure; counter = 0; for i=1:s:n axis([x(1) x(end) y(1) y(end)]); hold on for j=1:size(Fronts{i},1)-1 if ( sqrt( (Fronts{i}(j,1) - Fronts{i}(j+1,1))^2 + (Fronts{i}(j,2) - Fronts{i}(j+1,2))^2 ) < LimitDistance) plot([Fronts{i}(j, 1); Fronts{i}(j+1, 1)], [Fronts{i}(j, 2); Fronts{i}(j+1, 2)], '-b') end end j = size(Fronts{i},1); if ( sqrt( (Fronts{i}(j,1) - Fronts{i}(1,1))^2 + (Fronts{i}(j,2) - Fronts{i}(1,2))^2 ) < LimitDistance) plot([Fronts{i}(j, 1); Fronts{i}(1, 1)], [Fronts{i}(j, 2); Fronts{i}(1, 2)], '-b') end counter = counter + 1; M(counter) = getframe(gcf); hold off plot(0,0,'w'); end movie2avi(M, filename, 'fps', 3); return;