23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Common Data Format (CDF) Files<br />

Format: 'CDF'<br />

FormatVersion: '2.7.0'<br />

FileSettings: [1x1 struct]<br />

Subfiles: {}<br />

Variables: {5x6 cell}<br />

GlobalAttributes: [1x1 struct]<br />

VariableAttributes: [1x1 struct]<br />

Importing Data from a CDF File<br />

To import data into the <strong>MATLAB</strong> workspace from a CDF file, use the cdfread<br />

function. Using this function, you can import all the data in the file, specific<br />

variables, specific records, or subsets of the data in a specific variable. The<br />

following examples illustrate some of these capabilities.<br />

1 To get information about the contents of a CDF file, such as the names of<br />

variables in the CDF file, use the cdfinfo function. In this example, the<br />

Variables field indicates that the file contains five variables. The first<br />

variable, Time, is made up of 24 records containing CDF epoch data. The<br />

next two variables, Longitude and Latitude, have only one associated<br />

record containing int8 data. For details about how to interpret the data<br />

returned in the Variables field, see cdfinfo.<br />

info = cdfinfo('example.cdf');<br />

vars = info.Variables<br />

vars =<br />

Columns 1 through 5<br />

'Time' [1x2 double] [24] 'epoch' 'T/'<br />

'Longitude' [1x2 double] [ 1] 'int8' 'F/FT'<br />

'Latitude' [1x2 double] [ 1] 'int8' 'F/TF'<br />

'Data' [1x3 double] [ 1] 'double' 'T/TTT'<br />

'multidimensional [1x4 double] [ 1] 'uint8' 'T/TTTT'<br />

Column 6<br />

'Full'<br />

'Full'<br />

7-3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!