MATLAB importdata函数返回值类型

importdata函数是MATLAB中I/O文件操作的一个重要函数。需要注意的是,针对不同的文件内容,importdata函数的返回值类型也有所不同。

MATLAB帮助文档中的详细说明如下:

Based on the file format, importdata selects and calls a helper function to read the data. When the helper function returns more than one nonempty output, importdata combines the outputs into a struct array.

For ASCII files and spreadsheets, importdata expects to find numeric data in a rectangular form (that is, like a matrix). Text headers can appear above or to the left of the numeric data, as follows:

Column headers or file description text at the top of the file, above the numeric data.

Row headers to the left of the numeric data.

To import ASCII files with nonnumeric characters anywhere else, including columns of character data or formatted dates or times, use textscan instead of importdata. For more information, see Import Mixed Text and Numeric Data from a Text File.

When importing spreadsheets with columns of nonnumeric data, importdata cannot always correctly interpret the column and row headers.

If the ASCII file or spreadsheet contains either column or row headers, but not both, importdata returns a colheaders or rowheaders field in the output structure, where:

colheaders contains only the lowest line of column header text. importdata stores all text in the textdata field.

rowheaders is created only when the file or worksheet contains a single column of row headers.

posted on 2014-02-20 12:04  yuthreestone  阅读(1702)  评论(0编辑  收藏  举报

导航