Main Content

cdflib

Interact directly with CDF library

Description

MATLAB® provides direct access to dozens of functions in the CDF library. Using these functions, you can read and write data, create variables, attributes, and entries, and take advantage of other features of the CDF library. To use these functions, you must be familiar with the CDF C interface. Documentation about CDF is available at the CDF website.

The MATLAB functions correspond to functions in the CDF library new Standard Interface. In most cases, the syntax of a MATLAB function is similar to the syntax of the corresponding CDF library function. To use these functions, you must prefix the function name with the package name, cdflib. For example, to use the CDF library function to open an existing CDF file, use this syntax:

cdfid = cdflib.open("example.cdf");

The following tables list all of the functions in the MATLAB CDF library package, grouped by category.

Library Information

cdflib.getConstantNamesNames of Common Data Format (CDF) library constants
cdflib.getConstantValueNumeric value corresponding to Common Data Format (CDF) library constant
cdflib.getLibraryCopyrightCopyright notice of Common Data Format (CDF) library
cdflib.getLibraryVersionLibrary version and release information
cdflib.getValidateLibrary validation mode
cdflib.setValidateSpecify library validation mode

File Operations

cdflib.closeClose Common Data Format (CDF) file
cdflib.createCreate Common Data Format (CDF) file
cdflib.deleteDelete existing Common Data Format (CDF) file
cdflib.getCacheSizeNumber of cache buffers used
cdflib.getChecksumChecksum mode
cdflib.getCompressionCompression settings
cdflib.getCompressionCacheSizeNumber of compression cache buffers
cdflib.getCopyrightCopyright notice in Common Data Format (CDF) file
cdflib.getFormatFormat of Common Data Format (CDF) file
cdflib.getMajorityMajority of variables
cdflib.getNameName of Common Data Format (CDF) file
cdflib.getReadOnlyModeRead-only mode
cdflib.getStageCacheSizeNumber of cache buffers for staging
cdflib.getVersionCommon Data Format (CDF) library version and release information
cdflib.inquireBasic characteristics of Common Data Format (CDF) file
cdflib.openOpen existing Common Data Format (CDF) file
cdflib.setCacheSizeSpecify number of dotCDF cache buffers
cdflib.setChecksumSpecify checksum mode
cdflib.setCompressionSpecify compression settings
cdflib.setCompressionCacheSizeSpecify number of compression cache buffers
cdflib.setFormatSpecify format of Common Data Format (CDF) file
cdflib.setMajoritySpecify majority of variables
cdflib.setReadOnlyModeSpecify read-only mode
cdflib.setStageCacheSizeSpecify number of staging cache buffers for Common Data Format (CDF) file

Variables

cdflib.closeVarClose specified variable from multifile format Common Data Format (CDF) file
cdflib.createVarCreate new variable
cdflib.deleteVarDelete variable
cdflib.deleteVarRecordsDelete range of records from variable
cdflib.getVarAllocRecordsNumber of records allocated for variable
cdflib.getVarBlockingFactorBlocking factor for variable
cdflib.getVarCacheSizeNumber of multifile cache buffers
cdflib.getVarCompressionInformation about compression used by variable
cdflib.getVarDataSingle value from record in variable
cdflib.getVarMaxAllocRecNumMaximum allocated record number for variable
cdflib.getVarMaxWrittenRecNumMaximum written record number for variable
cdflib.getVarNameVariable name, given variable number
cdflib.getVarNumVariable number, given variable name
cdflib.getVarNumRecsWrittenNumber of records written to variable
cdflib.getVarPadValuePad value for variable
cdflib.getVarRecordDataEntire record for variable
cdflib.getVarReservePercentCompression reserve percentage for variable
cdflib.getVarSparseRecordsInformation about how variable handles sparse records
cdflib.getVarsMaxWrittenRecNumMaximum written record number for CDF file
cdflib.hyperGetVarDataRead hyperslab of data from variable
cdflib.hyperPutVarDataWrite hyperslab of data to variable
cdflib.inquireVarInformation about variable
cdflib.putVarDataWrite single value to variable
cdflib.putVarRecordDataWrite entire record to variable
cdflib.renameVarRename existing variable
cdflib.setVarAllocBlockRecordsSpecify range of records to be allocated for variable
cdflib.setVarBlockingFactorSpecify blocking factor for variable
cdflib.setVarCacheSizeSpecify number of multi-file cache buffers for variable
cdflib.setVarCompressionSpecify compression settings used with variable
cdflib.setVarInitialRecsSpecify initial number of records written to variable
cdflib.setVarPadValueSpecify pad value used with variable
cdflib.setVarReservePercentSpecify reserve percentage for variable
cdflib.setVarSparseRecordsSpecify how variable handles sparse records
cdflib.setVarsCacheSizeSpecify number of cache buffers used for all variables

Attributes

cdflib.createAttrCreate attribute
cdflib.deleteAttrDelete attribute
cdflib.deleteAttrEntryDelete attribute entry
cdflib.deleteAttrgEntryDelete entry in global attribute
cdflib.getAttrEntryValue of entry in attribute with variable scope
cdflib.getAttrMaxEntryNumber of last entry for variable attribute
cdflib.getAttrMaxgEntryNumber of last entry for global attribute
cdflib.getAttrNameName of attribute, given attribute number
cdflib.getAttrNumAttribute number, given attribute name
cdflib.getAttrScopeScope of attribute
cdflib.getAttrgEntryValue of entry in global attribute
cdflib.getNumAttrEntriesNumber of entries for attribute with variable scope
cdflib.getNumAttrgEntriesNumber of entries for attribute with global scope
cdflib.getNumAttributesNumber of attributes with variable scope
cdflib.getNumgAttributesNumber of attributes with global scope
cdflib.inquireAttrInformation about attribute
cdflib.inquireAttrEntryInformation about entry in attribute with variable scope
cdflib.inquireAttrgEntryInformation about entry in attribute with global scope
cdflib.putAttrEntryWrite value to entry in attribute with variable scope
cdflib.putAttrgEntryWrite value to entry in attribute with global scope
cdflib.renameAttrRename existing attribute

Utility Functions

cdflib.breakdownTT2000Convert CDF_TIME_TT2000 timestamp to time components
cdflib.computeEpochConvert time value to CDF_EPOCH value
cdflib.computeEpoch16Convert time value to CDF_EPOCH16 value
cdflib.computeTT2000Convert time components to CDF_TIME_TT2000 timestamp
cdflib.epoch16BreakdownConvert CDF_EPOCH16 value to time value
cdflib.epochBreakdownConvert CDF_EPOCH value to time value

Limitations

  • CDF files do not support non-ASCII encoded inputs. Variable names, attributes names, variable values, and attribute values must have 7-bit ASCII encoding. Attempting to write non-ASCII encoded inputs results in an error or data with corrupted characters.