function [theFile] = history(theFile,thecomment)

%appends the history with the comment requested
%will work on any netcdf file that has the 'history' attribute

%Need to make more generic

% Written by Jessica M. Cote
% for the U.S. Geological Survey
% Coastal and Marine Geology Program
% Woods Hole, MA
% http://woodshole.er.usgs.gov/
% Please report bugs to jcote@usgs.gov

%version
%updated 10-Aug-1999 16:20:42


g=netcdf(theFile,'write');

hist=g.History;
if isempty(hist)
   hist=g.PROG_CMNT1;
   hist=name(hist,'History');
disp(['Global Attribute "PROG_CMNT1" was changed to "History" in file' theFile]);  
end   

g.History=[hist(:) ';' thecomment];

close(g)
