Main Content

netcdf.inqVlen

Return information about user-defined NC_VLEN type

Since R2022a

Description

[typeName,byteSize,baseTypeID] = netcdf.inqVlen(ncid,typeID) returns information about the user-defined NC_VLEN (variable length array) type. The output arguments include the name of the NC_VLEN type, the size in bytes of the type, and the base type for the NC_VLEN type specified by the numeric type identifier. The netcdf.inqVlen function corresponds to the nc_inq_vlen function in the NetCDF library C API.

example

Examples

collapse all

Define an NC_VLEN type in a new NetCDF-4 file and return information for the type.

Create a new NetCDF-4 file named myfile.nc.

source = "myfile.nc";
cmode = "NETCDF4";
ncid = netcdf.create(source,cmode);

Define a new NC_VLEN type with the MY_VARIABLE_INT_ARRAY type name and NC_INT base type.

typeName = "MY_VARIABLE_INT_ARRAY";
baseType = "NC_INT";
typeID = netcdf.defVlen(ncid,typeName,baseType);

Return information for the NC_VLEN type using the numeric type identifier typeID. The results include the name of the NC_VLEN type, its size in bytes, and the numeric type identifier of the base type.

[typeName, byteSize, baseTypeID] = netcdf.inqVlen(ncid,typeID)
typeName = 
'MY_VARIABLE_INT_ARRAY'
byteSize = 
16
baseTypeID = 
4

Return the identifier of the NC_INT class. 4 is the identifier of the NC_INT class.

netcdf.getConstant("NC_INT")
ans = 
4

Close the NetCDF file.

netcdf.close(ncid)

Input Arguments

collapse all

Identifier of a netCDF source, specified as a nonnegative integer scalar. The netCDF source can be a netCDF file or a netCDF group.

Data Types: double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Data type identifier, specified as an integer. You can retrieve this identifier by using the netcdf.inqAtt or netcdf.inqVar functions.

Data Types: double

Output Arguments

collapse all

Name of the user-defined NC_VLEN type, returned as a character vector.

Size in bytes of the user-defined NC_VLEN type, returned as a double.

Type identifier for the base type of the user-defined NC_VLEN type, returned as a double. The baseTypeID represents the type of the elements inside the user-defined variable-length array.

Version History

Introduced in R2022a