cdflib.setVarCompression
Specify compression settings used with variable
Syntax
cdflib.setVarCompression(cdfId,varNum,ctype,cparams)
Description
cdflib.setVarCompression(cdfId,varNum,ctype,cparams)
configures the compression setting for a variable in a Common Data
Format (CDF) file.
Input Arguments
|
Identifier of a CDF file, returned by a call to | ||||||||||||
|
Numeric value identifying a variable in the file. Variable identifiers (variable numbers) are zero-based. | ||||||||||||
|
One of the following character vectors or string scalars specifying the compression type, or its numeric equivalent.
To get the numeric equivalent of these compression type values, use
| ||||||||||||
|
Optional parameter specifying any additional parameters required
by the compression type. Currently, the only compression type that
uses this parameter is |
Examples
Create a CDF, create a variable, and then set the compression used by the variable. To run this example, you must be in a folder with execute permission.
cdfId = cdflib.create("your_file.cdf"); % Create a variable in the file varNum = cdflib.createVar(cdfId,"Time","cdf_int1",1,[],true,[]); % Check the compression setting of the variable [ctype,params,percent] = cdflib.getVarCompression(cdfId,0)
ctype = 'NO_COMPRESSION' params = [] percent = 100
% Specify the compression used by the variable cdflib.setVarCompression(cdfId,0,"GZIP_COMPRESSION",8) % Check the new compression setting of the variable [ctype,params,percent] = cdflib.getVarCompression(cdfId,0)
ctype = 'GZIP_COMPRESSION' params = 8 percent = 0
%Clean up cdflib.delete(cdfId) clear cdfId
Tips
This function corresponds to the CDF library C API routine
CDFsetzVarCompression
.To use this function, you must be familiar with the CDF C interface. You can access the CDF documentation at the CDF website.