作者:乔山办公网日期:
返回目录:excel表格制作
使用 xlswrite()函数可以将matlab中数据保存来到excel中,请看下面源例子:
>> data = magic(5) % 示例数据
data =
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9
>> xlswrite('test.xls',data) % 保存excel文件,不写完知整道路径则表示当前目录
你可以直接在m文件里百面用xlswrite函数:(filename/sheet/range都是要加单引号滴)
xlswrite(filename, M);将矩阵M的数据写入度名为filename的Excel文件中。知
xlswrite(filename, M, sheet);将矩阵M的数据写入文件名为filename中的指定的sheet中。
xlswrite(filename, M, range);将矩阵M中的数据写入文件名为filename的Excel文件中,且由range制定存储的区域,例如'C1:C2'.
xlswrite(filename, M, sheet, range) ;在道上一条命令的基础上指定了所要存储的sheet。
status = xlswrite(filename, ...) ;返回完成状态值。专如果写入成功,则status为1;反之写入失败,则status为0.
[status, message] = xlswrite(filename, ...);返回由于写入操作而产属生的任何错误或警告信息
MATLAB是一款非常强大的数学软件,现在对于他的应用百除了数学领域,在很多工学和理学的领域里均有所涉及。MATLAB不仅可以生成二维和三维的图像,还可以生成动画并把他们输出度。
以matlab2010版为例,将matlab中的数据输出到excel中:
1、首先打开matlab,输入你的问代码,
2、找到你要存放文件的位置复制绝对路径,
3、然后写xlswrite函数,格式如图,具体格式课参看help xlswrite,如图xlswrite函数前一答项是路径,后一项是要输出的矩阵,
4、点击执行,稍等一下,就会在指定位置新建xls文件,
5、如要竖着输出数内据的话,将矩阵转置即可,在后面可控制输出数据在xls中的范围,如A:D,2:16等(注意:转置后原来容的数据只会被覆盖不会消失)
6、要读出xls中的文件时可用函数xlsread用法相同。
你可以直接在m文件里copy面用xlswrite函数:(filename/sheet/range都是要加单引号滴)
xlswrite(filename, M);将矩阵M的数据写入名为filename的Excel文件中。
xlswrite(filename, M, sheet);将矩阵M的数据写入文件名为filename中的指定的sheet中。
xlswrite(filename, M, range);将矩阵M中的数据写入文件名为filename的Excel文件中,且由range制定存储的区域,例如'C1:C2'.
xlswrite(filename, M, sheet, range) ;在上一条命令的基础上指定了所要存储的sheet。
status = xlswrite(filename, ...) ;返回完成状态值。如果写入成功,则status为1;反之写入失败,则status为0.
[status, message] = xlswrite(filename, ...);返回由于写入操作而产生的任何错误或警告zhidao信息