This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Close specified variable from multifile format Common Data Format (CDF) file




cdflib.closeVar(cdfId,varNum) closes a variable in a multifile format CDF.

cdfId identifies the CDF file and varNum is a numeric value that specifies the variable. Variable identifiers (variable numbers) are zero-based.

For multifile CDFs, you must close all open variable files to guarantee that all modifications you have made are actually written to the CDF file(s). You do not need to call this function for variables in a single-file format CDF.


Create a multifile CDF, create a variable, and then close the variable. To run this example, you must be in a writable folder.

cdfid = cdflib.create('your_multifile.cdf');

% Make it a multifile format CDF

% Create a variable in the CDF.
varNum = cdflib.createVar(cdfid,'Time','cdf_int1',1,[],true,[]);

%  Close the variable.
cdflib.closeVar(cdfid, varnum)

% Clean up
clear cdfid

Related Examples


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

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

For copyright information, see the cdfcopyright.txt file.

Was this topic helpful?