excel数据读取函数:
[num, txt, raw, X] = xlsread(filename, sheet, range)
filename, sheet, range 文件名,sheet名、范围
num, txt, raw, X 输出
excel数据写入函数:
[status, message] =xlswrite(filename, M, sheet, range)
filename, M, sheet, range 文件名,数据、sheet名、范围
Examples
Example 1— Reading Numeric Data
The Microsoft Excel spreadsheet file testdata1.xls contains this data:
1 6
2 7
3 8
4 9
5 10
To read this data into MATLAB, use this command:
A = xlsread('testdata1.xls')
A =
1 6
2 7
3 8
4 9
5 10
Example 2 — Handling Text Data
The Microsoft Excel spreadsheet file testdata2.xls contains a mix of numeric and text data:
1 6
2 7
3 8
4 9
5 text
xlsread puts a NaN in place