diff main/netcdf/inst/ncread.m @ 12561:8476336c120c octave-forge

ncread: do not replace _FillValue by NaNs for characters
author abarth93
date Fri, 20 Feb 2015 16:30:08 +0000
parents 24f335b0c8df
children f2cf7070ccb5
line wrap: on
line diff
--- a/main/netcdf/inst/ncread.m	Fri Feb 20 15:24:59 2015 +0000
+++ b/main/netcdf/inst/ncread.m	Fri Feb 20 16:30:08 2015 +0000
@@ -28,8 +28,9 @@
 ## loaded.
 ##
 ## If the variable has the _FillValue attribute, then the corresponding values
-## are replaced by NaN. NetCDF attributes scale_factor (default 1) and 
-## add_offset (default 0) are use the transform the variable during the loading:
+## are replaced by NaN (except for characters). NetCDF attributes scale_factor 
+## (default 1) and add_offset (default 0) are use the transform the variable 
+## during the loading:
 ##
 ## x = scale_factor * x_in_file + add_offset
 ##
@@ -97,7 +98,8 @@
   end
 end
 
-if !isempty(fv)
+if !isempty(fv) && xtype != netcdf_getConstant('char') && ...
+   xtype != netcdf_getConstant('string')
   x(x == fv) = NaN;
 end