Skip to Main Content Skip to Search
Product Documentation

cdflib.SetVarReservePercent - Specify reserve percentage for variable

Syntax

cdflib.setVarReservePercent(cdfId,varNum,percent)

Description

cdflib.setVarReservePercent(cdfId,varNum,percent) specifies the compression reserve percentage for 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

Numeric value identifying a variable in the file. Variable identifiers (variable numbers) are zero-based.

percent

Numeric value specifying the amount of extra space to allocate for a compressed variable, experssed as a percentage. You can specify values between0 (no extra space is reserved) and 100, or values greater than 100. The value specifies the percentage of the uncompressed size of the variable. If you specify a fractional reserve percentages, the library rounds the value down.

Definitions

reserve percentage

Specifies how much extra space to allocate for a compressed variable. This extra space allows the variable to expand when you write additional records to the variable. If you do not specify this room for growth, the library has to move the variable to the end of the file when the size expands and the space at the original location of the variable becomes wasted space.

Examples

Create a CDF, create a variable, set the compression of the variable, and then set the reserve percent for 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 compression of the variable.
cdflib.setVarCompression(cdfid,varNum,'GZIP_COMPRESSION',8);
        
% Set the compression reserver percentage
cdflib.setVarReservePercent(cdfid,varNum, 80);
        
cdflib.close(cdfid);

References

This function corresponds to the CDF library C API routine CDFsetzVarReservePercent. To use these functions, 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.getVarCompression | cdflib.getVarReservePercent | cdflib.setVarCompression

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