cdfread
Read data from Common Data Format (CDF) file
Syntax
data = cdfread(filename)
data = cdfread(filename,Name1,Value1,...,NameN,ValueN)
[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 datasets 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 differing 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
,Name1
,Value1
,...,NameN
,ValueN
)Name1
, …,
NameN
can be any of the name-value arguments listed in the
following table.
[data,info] = cdfread(
returns details about the CDF file in the filename
,...)info
structure.
Name-Value Argument | Value |
---|---|
"Records" | A vector specifying which records to read. Record numbers are zero-based.
|
"Variables" | A string scalar or character vector specifying the name of a single variable to read
from the file, or a 1-by-n or
n-by-1 cell array specifying the
names of one or more 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, and so on), 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
|
"DatetimeType" | A string scalar or character vector that controls the
return type of |
"CombineRecords" | A logical 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
CombineRecords
name-value argument.
Note
To improve performance, turn off the file validation that the CDF library
executes 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.