MATLAB Function Reference Previous page   Next Page

Read data from CDF file



data = cdfread(file) reads all the variables from each record of the Common Data Format (CDF) file specified in the string file. The return value data is a cell array in which each row contains a record and each column represents a variable. See the Examples section for an illustration.

data = cdfread(file, 'records', recnums, ...) reads only those records specified in the vector recnums. The record numbers are zero based. The return value data is a cell array having length(recnums) number of rows and as many columns as there are variables.

data = cdfread(file, 'variables', varnames, ...) reads only those variables specified in the 1-by-N or N-by-1 cell array of strings varnames. The return value data is returned in a cell array having length(varnames) number of columns and a row for each record requested.

data = cdfread(file, 'slices', dimensionvalues, ...) reads specific values from the records of one variable in the CDF file. The N-by-3 matrix dimensionvalues indicates which records are to be read by specifying start, interval, and count parameters for each of the N dimensions of the variable. The start parameter is zero based.

The number of rows in dimensionvalues must be less than or equal to the number of dimensions of the variable. Unspecified rows default to [0 1 N], where N is the total number of values in a record. This causes cdfread to read every value from those dimensions.

Because you can read just one variable at a time, you must also include a 'variables' parameter with this syntax.

[data, info] = cdfread(file, ...) also returns details about the CDF file in the info structure.


Read all the data from the file.

Read just the data from variable 'Time'.

Read the first value in the first dimension, the second value in the second dimension, the first and third values in the third dimension, and all values in the remaining dimension of the variable 'multidimensional'.

This is similar to reading the whole variable into 'data' and then using the MATLAB command

See Also

cdfinfo, cdfwrite, cdfepoch

Previous page  cdfinfo cd (ftp) Next page

© 1994-2005 The MathWorks, Inc.