function yn = nc_isunlimitedvar ( ncfile, varname )
% NC_ISUNLIMITEDVAR:  yes if the given variable has a record dimension
%
% USAGE:  yn = nc_isunlimitedvar ( ncfile, varname );
%
% PARAMETERS:
% Input:
%   ncfile:  
%      Input netcdf file name.
%   varname:  
%      variable to check
% Output:
%   yn:
%        1 if it does indeed have an unlimited dimension, 0 otherwise
%
% Throws an exception in case of an error condition.
%
%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% $Id: nc_isunlimitedvar.m 1741 2006-08-29 16:35:33Z johnevans007 $
% $LastChangedDate: 2006-08-29 12:35:33 -0400 (Tue, 29 Aug 2006) $
% $LastChangedRevision: 1741 $
% $LastChangedBy: johnevans007 $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



if ( nargin ~= 2 )
	error ( '%s:  Must have two input arguments.\n', mfilename );
end

if ~ischar ( varname )
	error ( '%s:  varname argument must be of character datatype.\n', mfilename );
end

DataSet = nc_getvarinfo ( ncfile, varname );

if DataSet.IsUnlimitedVariable
	yn = 1;
else
	yn = 0;
end


return;
