How to find the total number of attributes attached to a variable in Matlab netcdf?

4 次查看(过去 30 天)
I am trying to write a loop (for i=1:m) to find all the attributes attached to each variable, but could not figure out how to find the total number of attributes (the value of 'm' within the loop). Below are all the attribute inquiry functions I find in Matlab:
attname = netcdf.inqAttName(ncid, varid, 0);
[xtype,attlen] = netcdf.inqAtt(ncid, varid, attname);
attid = netcdf.inqAttID(ncid,varid, attname);
It seems that none of the above functions will be able to tell me the number of attributes attached to each variable.

采纳的回答

Ashish Uthama
Ashish Uthama 2011-12-15
Leon,
Have a look at netcdf.inqVar.
This page will give you an overview of all available netcdf.* functions: netcdf reference.

更多回答(1 个)

Walter Roberson
Walter Roberson 2011-12-14
ncinfo against the variable name, and look at the Attributes field of vinfo

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by