netcdf.inqUserType - Return information about user-defined type - MATLAB (original) (raw)

Return information about user-defined type

Since R2022a

Syntax

Description

[[typeName](#mw%5F1eafa958-79f9-4f7f-ada1-87b984cdd7bb),[byteSize](#mw%5F93eba674-2cf4-4d79-97c8-07de83b23a40),[baseTypeID](#mw%5F4cb5502a-1e8b-4769-ac94-fec74449b269),[numFields](#mw%5Ff6dc3d3c-eca5-425f-a141-f7cbe387a6a3),[classID](#mw%5Fdc5b939f-957c-4475-a2b4-5b12e19333a5)] = netcdf.inqUserType([ncid](#mw%5Fd4f5283f-9b57-4916-a4bb-6dbba2f394e6%5Fsep%5Fmw%5Ff7e816d5-6ef7-4555-b9bd-92e4e220788a),[typeID](#mw%5F1fc804ca-f87c-4734-a3e1-f14a1b315452)) returns information about the user-defined type specified by the numeric type identifier in the file identified by ncid. The output arguments include the name of the user-defined type, the size in bytes of the type, the numeric identifier of the base type, the number of fields, and the class identifier of the user-defined type. Not all returned information is applicable for all user-defined types. Thenetcdf.inqUserType function corresponds to thenc_inq_user_type function in the NetCDF library C API.

example

Examples

collapse all

Define an NC_VLEN type in a new NetCDF4 file and return information about it. An NC_VLEN type is a variable length array.

Create a new NetCDF4 file named myfile.nc.

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

Define a new NC_VLEN type with the MY_VLEN type name and NC_DOUBLE base type.

typeName = "MY_VLEN"; baseType = "NC_DOUBLE"; typeID = netcdf.defVlen(ncid,typeName,baseType);

Return information about the NC_VLEN type using its numeric type identifier typeID.

[typeName,byteSize,baseTypeID,numFields, ... classID] = netcdf.inqUserType(ncid,typeID)

The results include:

Return the identifier of the NC_VLEN class. 13 is the identifier of the NC_VLEN class.

netcdf.getConstant("NC_VLEN")

Close the NetCDF file.

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 type, returned as a character vector.

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

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

This returned information is not applicable for all user-defined types. Thenetcdf.inqUserType function returns baseTypeID as 0 when it is not applicable for the class of the specified user-defined type.

Number of fields of the user-defined type, returned as a double. This returned information is not applicable for all user-defined types. Thenetcdf.inqUserType function returns numFields as 0 when it is not applicable for the class of the specified user-defined type.

Class identifier of the user-defined type, returned as a double. ForNC_VLEN types, the class identifier is 13. You can use thenetcdf.getConstant function to return this identifier.

Version History

Introduced in R2022a