function next_note_num = mcnote(cdfid, varid, text, note_num);
%function next_note_num = mcnote(cdfid, varid, text, note_num);
%
% Annotate netCDF variables by using text attributes of the form
%
%	NOTE_# ==> 'This is a note about this data'
%
% written by the command
% 	mexcdf('ATTPUT',cdfid,varid,['NOTE_',int2str(note_num)],...
% 	'CHAR',length(text),text);
%
% Where: 
%	cdfid = the handle of a netCDF file opened 
%		for writing   
%	varid = the variable id, can be NC_GLOBAL
%	text = the text of the annotation
%	note_num = the number of the note
%	new_note_num = the number to use for the next note
%

% we want feedback in case the user forgot to open the file
opts = mexcdf('SETOPTS','NC_VERBOSE');

mexcdf('ATTPUT',cdfid,varid,['NOTE_',int2str(note_num)],...
	'CHAR',length(text),text);

% reset opts to the original state
mexcdf('SETOPTS',opts);

new_note_num = note_num+1;

