function dump3d(a,f)
%
fd = fopen(f,'w');
[m,n] = size(a);

for r = 1:m
  for c = 1:n
    fprintf(fd,'%d %d %d\n',c,r,a(r,c));
  end
end
fclose(fd);
