Main Content

cdflib.setVarBlockingFactor

指定变量的分块因子

语法

cdflib.setVarBlockingFactor(cdfId,varNum,blockingFactor)

说明

cdflib.setVarBlockingFactor(cdfId,varNum,blockingFactor) 指定常用数据格式 (CDF) 文件中的变量的分块因子。

输入参数

cdfId

CDF 文件的标识符,通过调用 cdflib.createcdflib.open 返回。

varNum

标识文件中的变量的数值。变量编号从 0 开始。

blockingFactor

指定当写入未分配的记录时要分配的记录数的数值。

示例

创建一个 CDF 文件,在该 CDF 文件中创建一个变量,然后设置用于该变量的分块因子。要运行此示例,当前必须位于可写文件夹中。

cdfId = cdflib.create("your_file.cdf");

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

% Get the current blocking factor used with the variable 
bFactor = cdflib.getVarBlockingFactor(cdfId,varNum)
bFactor =

     0
% Change the blocking factor for the variable
cdflib.setVarBlockingFactor(cdfId,varNum,10);

% Check the new blocking factor
bFactor = cdflib.getVarBlockingFactor(cdfId,varNum)
bFactor =

    10
%Clean up
cdflib.delete(cdfId)
clear cdfId

详细信息

全部折叠

分块因子

变量的分块因子指定当写入到未分配的记录时库分配的最低记录数。如果指定小数分块因子,库将对该值向下四舍五入。

参考

此函数对应于 CDF 库的 C API 例程 CDFsetzVarBlockingFactor

要使用此函数,必须熟悉 CDF C 接口。您可以在 CDF 网站上访问 CDF 文档。