function writetext(File, txt)
%WRITETEXT Write a string to a text file
%
%     writetext(FileName, txt)
%
% Write a string in an ascii file.
%

% Copyright (c) 1996 by Claudio Rivetti 
% claudio@alice.uoregon.edu
%
% Last version: June 23,  1996.

if nargin < 1
	error('Too few input arguments.');
end
if nargin == 1
	txt='';
end
if nargin > 2
	error('Too many input arguments.');
end

[fp, msg]=fopen(File, 'w+');
if fp==-1
        error(msg);
end

for i=1:size(txt,1)
  fprintf(fp, '%s\n', txt(i,:));
end

fclose(fp);

return
