function [yn, return_status] = nc_isunlimitedvar ( ncfile, varname )
% NC_ISUNLIMITEDVAR:  yes if the given variable has a record dimension
%
% USAGE:  [yn, status] = 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
%   status:
%      -1 if the routine fails because of bad input
%       0 if the routine succeeds
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% $Name:  $
% $Id: nc_isunlimitedvar.m,v 1.1 2005/06/29 16:07:00 brian Exp $
% AUTHOR:  johnevans@acm.org
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

yn = 0;
return_status = -1;

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


[DataSet, status] = nc_getvarinfo ( ncfile, varname );
if ( status < 0 )
	format = '%s:  nc_getvarinfo failed on file ''%s'', variable ''%s''.\n';
	fprintf ( 2, format, mfilename, ncfile, varname );
	return
end

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

return_status = 0;

return;


