1 |
function [FillVal]=ncgetFillVal(ncid,varname); |
function [FillVal]=ncgetFillVal(ncid,varname); |
2 |
% [FillVal]=ncgetFillVal(ncid,varname) |
% [FillVal]=ncgetFillVal(ncid,varname) |
3 |
% return the missing_value or _FillValue of varname |
% return the missing_value or _FillValue of varname |
4 |
|
% return an error if varname does not exist |
5 |
|
|
6 |
global useNativeMatlabNetcdf; |
global useNativeMatlabNetcdf; |
7 |
if isempty(useNativeMatlabNetcdf); useNativeMatlabNetcdf = ~isempty(which('netcdf.open')); end; |
if isempty(useNativeMatlabNetcdf); useNativeMatlabNetcdf = ~isempty(which('netcdf.open')); end; |
20 |
FillVal=double(FillVal); |
FillVal=double(FillVal); |
21 |
end |
end |
22 |
else |
else |
23 |
FillVal = ncid{varname}.missing_value(:); |
eval(['FillVal = ncid{''' varname '''}.missing_value(:);']); |
24 |
if isempty(FillVal); |
if isempty(FillVal); |
25 |
FillVal = ncid{varname}.FillValue_(:); |
eval(['FillVal = ncid{''' varname '''}.FillValue_(:);']); |
26 |
end |
end |
27 |
end |
end |
28 |
|
|