Main Content

cdflib.setVarsCacheSize

指定用于所有变量的高速缓存缓冲区的数目

语法

cdflib.setVarsCacheSize(cdfId,varNum,numBuffers)

说明

cdflib.setVarsCacheSize(cdfId,varNum,numBuffers) 指定 CDF 库用于多文件格式常用数据格式 (CDF) 文件中的变量的高速缓存缓冲区数。

此函数不适用于单文件 CDF 文件。有关高速缓存的详细信息,请参阅 CDF 用户指南

输入参数

cdfId

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

varNum

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

numBuffers

指定高速缓存缓冲区的数值。

示例

创建一个多文件 CDF 文件并指定用于所有变量的缓冲区的数目。要运行此示例,当前必须位于可写文件夹中。

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

% Set the format of the file to be multi-file
cdflib.setFormat(cdfId,"MULTI_FILE")

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

% Note how the library creates a separate file for the variable
ls your_file.*
your_file.cdf  your_file.z0   
% Determine the number of cache buffers used with the variable
numBuf = cdflib.getVarCacheSize(cdfId,varNum)
numBuf =

     1
% Specify the number of cache buffers used by all variables in CDF
cdflib.setVarsCacheSize(cdfId,6)

% Check the number of cache buffers used with the variable
numBuf = cdflib.getVarCacheSize(cdfId,varNum)
numBuf =

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

参考

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

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