Main Content


Read hyperslab of data from variable


data = cdflib.hyperGetVarData(cdfId,varNum,recSpec,dimSpec)
data = cdflib.hyperGetVarData(cdfId,varNum,recSpec)


data = cdflib.hyperGetVarData(cdfId,varNum,recSpec,dimSpec) reads a hyperslab of data from a variable in the Common Data Format (CDF) file. Hyper access allows more than one value to be read from or written to a variable with a single call to the CDF library.

data = cdflib.hyperGetVarData(cdfId,varNum,recSpec) reads a hyperslab of data for a zero-dimensional variable in the Common Data Format (CDF) file.

Input Arguments


Identifier of a CDF file, returned by a call to cdflib.create or


Number identifying the variable containing the datum.


Three-element array, [RSTART RCOUNT RSTRIDE], where RSTART, RCOUNT, and RSTRIDE are scalar values specifying the starting record, number of records to read, and the sampling interval or stride between records. Record numbers are zero-based.


Three-element cell array, {DSTART DCOUNT DSTRIDE}, where DSTART, DCOUNT, and DSTRIDE are n-element vectors that describe the start, number of values along each dimension, and sampling interval along each dimension. If the hyperslab has zero dimensions, you can omit this parameter. Dimension indices are zero-based.


Open the example CDF file, and then get all the data associated with a variable:

cdfid ='example.cdf');

% Determine the number of records allocated for the first variable in the file.
maxRecNum = cdflib.getVarMaxWrittenRecNum(cdfid,0);

% Retrieve all data in records for variable.
data = cdflib.hyperGetVarData(cdfid,0,[0 maxRecNum 1]);

%  Clean up.

clear cdfid


This function corresponds to the CDF library C API routine CDFhyperGetzVarData.

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

Version History

expand all