cdflib.hyperGetVarData

Read hyperslab of data from variable

Syntax

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

Description

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

cdfId

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

varNum

Number identifying the variable containing the datum.

recSpec

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.

dimSpec

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.

Examples

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

cdfid = cdflib.open('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
cdflib.close(cdfid)

clear cdfid

References

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

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

For copyright information, see the cdfcopyright.txt file.