Matlab 读取nc文件报错解决方法

读取nc文件报如下错误的解决方法: 去掉路径中的中文!!!

Warning: The following error was caught while executing
'internal.matlab.imagesci.nc' class destructor:
Error using netcdflib
The NetCDF library encountered an error during execution of 'close'
function - 'Not a valid ID (NC_EBADID)'.

Error in netcdf.close (line 16)
netcdflib('close', ncid);

Error in internal.matlab.imagesci.nc/close (line 139)
                netcdf.close(this.ncRootid);

Error in internal.matlab.imagesci.nc/delete (line 134)
            this.close();

Error in internal.matlab.imagesci.nc (line 95)
        function this = nc(varargin)

Error in ncinfo (line 88)
ncObj   = internal.matlab.imagesci.nc(ncFile);

Error in ddd (line 5)
ncinfo('pr_day_CMCC-ESM2_historical_r1i1p1f1_gn_19500101-19741231.nc'); 
> In internal.matlab.imagesci.nc (line 95)
  In ncinfo (line 88)
  In ddd (line 5) 
Error using netcdflib
The NetCDF library encountered an error during execution of 'inqFormat'
function - 'Not a valid ID (NC_EBADID)'.

Error in netcdf.inqFormat (line 29)
fmt = netcdflib('inqFormat',ncid);

Error in internal.matlab.imagesci.nc/openToRead (line 1281)
            this.Format = lower(netcdf.inqFormat(this.ncRootid));

Error in internal.matlab.imagesci.nc (line 121)
                    this.openToRead();

Error in ncinfo (line 88)
ncObj   = internal.matlab.imagesci.nc(ncFile);

Error in ddd (line 5)
ncinfo('pr_day_CMCC-ESM2_historical_r1i1p1f1_gn_19500101-19741231.nc');
 
>> 

在这里插入图片描述


版权声明:本文为weixin_46604505原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。