Skip to Main Content Skip to Search
Product Documentation

cdflib.closeVar - Close specified variable from multifile format Common Data Format (CDF) file

Syntax

cdflib.closeVar(cdfId,varNum)

Description

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.

Examples

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
cdflib.setFormat(cdfid,'MULTI_FILE')

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

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

% Clean up
cdflib.delete(cdfid)
clear cdfid

References

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 Web site. For copyright information, see the cdfcopyright.txt file.

See Also

cdflib.getFormat | cdflib.getVarNum | cdflib.setFormat

Tutorials

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS