用matlab如何将一个数组写入到excel中?

如题所述

用matlab读或写excel数据的方法:

% 从excel文件中读数据
[N, T, rawdata] = xlsread(file, sheet, range); % sheet 和 range可以省略
file是excel文件的地址,sheet是excel文件中指定的工作表, range是工作表中要读取数据的范围
N是数字型数据, T是文件型数据, rawdata是所有数据(cell型)

% 将数据写入excel文件
xlswrite(filename,A,sheet,range); % A就是待写的数据


[N, T, rawdata] = xlsread('d:\tmp.xls', 'sheet1', 'a1:b2');
xlswrite('d:\tmp.xls', rawdata, 'sheet2'); % 需保证文件'tmp.xls'未被打开

winopen('d:\tmp.xls'); % 打开excel文件

更多用法可以查看matlab的帮助
温馨提示:答案为网友推荐,仅供参考