diff main/netcdf/inst/ncread.m @ 12711:a4de85b2e6a0 octave-forge

fix bug 47014 and make test code work in matlab
author abarth93
date Fri, 19 Feb 2016 13:45:14 +0000
parents f2cf7070ccb5
children
line wrap: on
line diff
--- a/main/netcdf/inst/ncread.m	Mon Feb 15 20:43:15 2016 +0000
+++ b/main/netcdf/inst/ncread.m	Fri Feb 19 13:45:14 2016 +0000
@@ -95,14 +95,22 @@
   end    
 end
 
-if !isempty(factor) || !isempty(factor) || !isempty(offset)
+netcdf_close(ncid);
+
+# the scaling does not make sense of characters
+if xtype == netcdf_getConstant('char') || ...
+   xtype == netcdf_getConstant('string')
+
+   return;
+end
+
+if !isempty(fv) || !isempty(factor) || !isempty(offset)
   if !isa(x,'double')
     x = double(x);
   end
 end
 
-if !isempty(fv) && xtype != netcdf_getConstant('char') && ...
-   xtype != netcdf_getConstant('string')
+if !isempty(fv)
   x(x == fv) = NaN;
 end
 
@@ -114,4 +122,3 @@
   x = x + offset;
 end
 
-netcdf_close(ncid);