Main Content

cdflib.setVarInitialRecs

Specify initial number of records written to variable

Syntax

cdflib.setVarInitialRecs(cdfId,varNum,numrecs)

Description

cdflib.setVarInitialRecs(cdfId,varNum,numrecs) specifies the initial number of records to write to 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 numbers are zero-based.

numRecs

Numeric value specifying the number of records to write.

Examples

Create a CDF, create a variable, and then specify the number of records to write 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,"Grades","cdf_int1",1,[],true,[]);

% Check number of records to write for the variable
recsWritten = cdflib.getVarNumRecsWritten(cdfId,varNum)
recsWritten =

     0
% Specify new number of records to write for the variable
cdflib.setVarInitialRecs(cdfId,varNum,100);

% Check new number of records to write for the variable
recsWritten = cdflib.getVarNumRecsWritten(cdfId,varNum)
recsWritten =

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

Tips

  • This function corresponds to the CDF library C API routine CDFsetzVarInitialRecs.

  • To use this function, you must be familiar with the CDF C interface. You can access the CDF documentation at the CDF website.