Programming Previous page   Next Page

Importing Numeric Data with Text Headers

To import an ASCII data file that contains text headers, use the textscan function, specifying the headerlines parameter. textscan accepts a set of predefined parameters that control various aspects of the conversion. (For a complete list of these parameters, see the textscan reference page.) Using the headerlines parameter, you can specify the number of lines at the head of the file that textscan should ignore.

For example, the file grades.dat contains formatted numeric data with a one-line text header:

To import this data, first open the file and then use this textscan command to read the contents:

Previous page  Importing Delimited ASCII Data Files Importing Mixed Alphabetic and Numeric Data Next page

© 1994-2005 The MathWorks, Inc.