Determine if variable name exists in netcdf file.
显示 更早的评论
I need to check if a variable name exist in a netcdf file. Is there a way to do this without creating a list variable names and searching it entry by entry in a loop?
I think I can catch it with the warnings produced:
>> a=netcdf.inqVarID(ncid,'u_d')
Error using netcdflib
The NetCDF library encountered an error during execution of 'inqVarID' function - 'Variable not found (NC_ENOTVAR)'.
Error in netcdf.inqVarID (line 22)
varid = netcdflib('inqVarID', ncid, varname);
but Im not familiar with warnings.
采纳的回答
更多回答(1 个)
francisco
2013-5-14
0 个投票
Hello Jason
I have the same problem, can you help me on this please.
1 个评论
Vijay Sagar
2020-7-23
The above solution by @Jason worked for me. I had a different 'exception' for my files. I have repaced with that after that it worked successfuly for me.
类别
在 帮助中心 和 File Exchange 中查找有关 NetCDF 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!