Main Content


Specify library validation mode




cdflib.setValidate(mode) specifies the validation mode of the Common Data Format (CDF) library. Specify the validation mode before opening any files.

Input Arguments


One of the following character vectors or string scalars, or its numeric equivalent:

'VALIDATEFILEon'Turns validation mode on. With validation mode on, the library performs sanity checks on the data fields in the CDF' file's internal data structures to make sure that the values are within valid ranges and consistent with the defined values/types/entries. This mode also ensures that variable and attribute associations within the file are valid. Note, however, that enabling this mode will, in most cases, slow down the file opening process, especially for large or very fragmented files.
'VALIDATEFILEoff'Turns validation mode off.

To get the numeric equivalent of these values, use cdflib.getConstantValue.


Set the validation mode of the CDF library.

mode = cdflib.getValidate()
mode =



This function corresponds to the CDF library C API routine CDFsetValidate.

To use this function, you must be familiar with the CDF C interface. You can access the CDF documentation at the CDF website.