function  matcolor(datamat,perms,numperms)

%MATCOLOR constructs a color movie of the effects of a series of 
%  permutations on a proxmity matrix.
%  DATAMAT is an $n \times n$ symmetric proximity matrix;
%  PERMS is a cell array containing NUMPERMS permutations.

m=moviein(numperms);

for i=1:numperms
   pcolor(datamat(perms{i},perms{i}));
   axis ij off;
   colormap(bone(256));
   colorbar;
   m(:,i) = getframe;
end   
   movie(m);

