function []=write(a,heading,idigit);
%function []=write(a,heading,idigit);
%              makes string format of a

if nargin==2
	idigit=2;
end;
[imax,jmax]=size(a);
for i=1:imax
	temp=' ';
	for j=1:jmax
		if a(i,j)==nan
			temp=[temp,'  *  '];
		elseif idigit==0
			temp=[temp,sprintf('%7.0f',a(i,j))];
		elseif idigit==1	
			temp=[temp,sprintf('%7.1f',a(i,j))];
		else
			temp=[temp,sprintf('%7.2f',a(i,j))];
		end
	end
	astring(i,:)=temp;
end
diary temp.tex
time=clock;
disp(['                                              ',..
      sprintf('%6.0f%6.0f%6.0f',time(2),time(3),time(1)),..
      sprintf('    %6.0f:%2.0f',time(4),time(5))])
disp('       ')
disp(['       ',heading])
disp('       ')
disp(astring)
%      bstring=' ';
%      bstring=[bstring,12];
%      disp(bstring(2));
diary;
input('type 1 to print out');
if ans==1
	!lpl /header0 temp.tex
end
