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

本文介绍了当尝试读取NC文件时遇到特定错误的解决办法。主要问题是路径中包含中文字符导致的,解决方法是移除路径中的中文字符。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

读取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');
 
>> 

在这里插入图片描述

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值