Main Content

cdflib.putVarRecordData

Write entire record to variable

Syntax

cdflib.putVarRecordData(cdfId,varNum,recNum,recordData)

Description

cdflib.putVarRecordData(cdfId,varNum,recNum,recordData) writes data to a record in 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 that identifies the variable to which you want to write the datum. Variable numbers are zero-based.

recNum

Numeric value identifying the location of the datum in the variable. Record numbers are zero-based.

recordData

Data to be written to the variable.

Examples

Create a CDF, create a variable, and write an entire record of data to 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,[]);

% Write some data to the variable
cdflib.putVarRecordData(cdfId,varNum,0,int8(98))

% Read the value from the variable
datum = cdflib.getVarData(cdfId,varNum,0)
datum =

  int8

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

Tips

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

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