function GAmovie(deg, dang, base, fn)
% GAmovie(ang,dang): Rotate the views in all subwindows
% simultaneously making a movie as it goes.
%
%  The arguments are optional.  
%   ang: the number of total degrees (default 360)
%   dang: the delta angle (10)
%   base: base file name for movie (frame)
%   fn: initial frame number (1)
%See also gable.

% GABLE, Copyright (c) 1999, University of Amsterdam
% Copying, use and development for non-commercial purposes permitted.
%          All rights for commercial use reserved; for more information
%          contact Leo Dorst (leo@wins.uva.nl).
%
%          This software is unsupported.
if nargin==0
  deg = 360;
end
[az el] = view;
if nargin < 2
  dang = 10;
end
if nargin < 3
  base = 'frame';
end
if nargin < 4
  fn = 1;
end

n = deg/dang;
iaz = az;

sp = get(gcf,'Children');
for j=1:length(sp)
  subplot(sp(j))
  axis vis3d
end

for i=1:n
  for j=1:length(sp)
    subplot(sp(j))
    view([az+i*dang el])
  end
  drawnow
  imwrite(frame2im(getframe),sprintf('%s%04d.png',base,fn), 'png');
  fn = fn+1;
end
