cdfread
Read data from Common Data Format (CDF) file
Syntax
data = cdfread(filename)
data = cdfread(filename,param1,val1,param2,val2,...)
[data,info] = cdfread(filename,...)
Description
data = cdfread(
reads
all the data from the Common Data Format (CDF) file specified by
filename
)filename
. Specify filename
as a string
scalar or character vector. CDF data sets typically contain a set of variables of a
specific data type, each with an associated set of records. A variable might
represent time values with each record representing a specific time that an
observation was recorded. cdfread
returns all the data in a cell
array where each column represents a variable and each row represents a record
associated with a variable. If the variables have varying numbers of associated
records, cdfread
pads the rows to create a rectangular cell
array, using pad values defined in the CDF file.
Note
Because cdfread
creates temporary files, the current
working directory must be writable.
data = cdfread(
reads data from the file, where filename
,param1
,val1
,param2
,val2
,...)param1
,
param2
, and so on, can be any of the parameters listed in
this table.
[data,info] = cdfread(
returns details about the CDF file in the filename
,...)info
structure.
Parameter | Value |
---|---|
"Records" | A vector specifying which records to read. Record numbers are zero-based.
|
"Variables" | A 1-by-n or n-by-1 cell array specifying the
names of the variables to read from the file.
n must be less than or equal to the
total number of variables in the file.
|
"Slices" | An m-by-3 array, where each row specifies where to start reading
along a particular dimension of a variable, the skip
interval to use on that dimension (every item, every other
item, etc.), and the total number of values to read on that
dimension. m must be less than or equal
to the number of dimensions of the variable. If
m is less than the total number of
dimensions, Note: Because the
|
"ConvertEpochToDatenum" | A Boolean value that determines whether Note: For
better performance when reading large data sets, set this
parameter to Note: If
you use the |
"DatetimeType" | A string scalar or character vector that controls the
return type of Note: If you use
the |
"CombineRecords" | A Boolean value that determines how Note: If
you use the Note: When using the
|
Note
To improve performance when working with large data files, use the
"ConvertEpochToDatenum"
and
"CombineRecords"
options.
Note
To improve performance, turn off the file validation which the
CDF library does by default when opening files. For more information,
see cdflib.setValidate
.
Examples
Limitations
The
cdfread
function does not support non-ASCII encoded data. All the variable names, attribute names, variable values, and attribute values in the CDF file must have 7-bit ASCII encoding. Attempting to read non-ASCII encoded files results in errors or data with corrupted characters.