Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

cdflib.setVarSparseRecords

Specify how variable handles sparse records

Syntax

cdflib.getVarSparseRecords(cdfId,varNum,stype)

Description

cdflib.getVarSparseRecords(cdfId,varNum,stype) specifies the sparse records type of a variable in a Common Data Format (CDF) file.

Input Arguments

cdfId

Identifier of a CDF file, returned by a call to cdflib.create or cdflib.open.

varNum

Number that identifies the variable to be set. Variable numbers are zero-based.

stype

One of the following character vectors, or its numeric equivalent, that specifies how the variable handles sparse records.

Value Description
'NO_SPARSERECORDS'No sparse records
'PAD_SPARSERECORDS'For sparse records, the library uses the variable's pad value when reading values from a missing record.
'PREV_SPARSERECORDS'For sparse records, the library uses values from the previous existing record when reading values from a missing record. If there is no previous existing record, the library uses the variable's pad value.

To get the numeric equivalent of the constants specified by these character vectors, use the cdflib.getConstantValue function.

Examples

Open a multifile CDF and close a variable.

Create a CDF, create a variable, and set the sparse records type of the variable. To run this example you must be in a writable folder.

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

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

% Set the sparse records type of the variable
cdflib.setVarSparseRecords(cdfid,varNum,'PAD_SPARSERECORDS');

% Check the sparse records type of the variable
stype = cdflib.getVarSparseRecords(cdfid,varNum)

stype =

PAD_SPARSERECORDS


%Clean up
cdflib.delete(cdfid);

clear cdfid

References

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

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?