[Dart-dev] [7061] DART/trunk/matlab/nc_var_exists.m: Added the NC_NOWRITE option to the netcdf.open() to make it

nancy at ucar.edu nancy at ucar.edu
Mon Jul 14 15:22:19 MDT 2014


Revision: 7061
Author:   thoar
Date:     2014-07-14 15:22:19 -0600 (Mon, 14 Jul 2014)
Log Message:
-----------
Added the NC_NOWRITE option to the netcdf.open() to make it
behave more consistently for all versions of Matlab.

Modified Paths:
--------------
    DART/trunk/matlab/nc_var_exists.m

-------------- next part --------------
Modified: DART/trunk/matlab/nc_var_exists.m
===================================================================
--- DART/trunk/matlab/nc_var_exists.m	2014-07-11 14:57:33 UTC (rev 7060)
+++ DART/trunk/matlab/nc_var_exists.m	2014-07-14 21:22:19 UTC (rev 7061)
@@ -17,7 +17,7 @@
 %
 % EXAMPLE 3 (also a success):
 % fname = 'obs_diag_output.nc';
-% ncid  = netcdf.open(fname);
+% ncid  = netcdf.open(fname,'NC_NOWRITE');
 % varname = 'time';
 % [variable_present, varid] = nc_var_exists(fname,varname);
 % if (variable_present), mytime = netcdf.getVar(ncid,varid); end
@@ -38,7 +38,7 @@
    if (strcmp(finfo.Variables(ivar).Name, deblank(varname)))
       % TJH DEBUG  fprintf('Matched Variable "%s" \n', vinfo.Variables(ivar).Name )
       variable_present = 1;
-      ncid  = netcdf.open(fname);
+      ncid  = netcdf.open(fname,'NC_NOWRITE');
       varid = netcdf.inqVarID(ncid,varname);
       netcdf.close(ncid);
       return


More information about the Dart-dev mailing list