MATLAB读取excel文件中的数据

MATLAB读取excel中的数据

读取sheet1中的数据

MATLAB读取excel文件中的数据

  1. [num,txt,raw]=xlsread(\'C:\Users\Administrator\Desktop\test\a.xls\')

  2. %num返回的是excel中的数据,txt输出的是文本内容,raw输出的是未处理数据

  3. %一般情况下,我们读取的是excel中的数据,所以可以直接用下面的,只输出数据矩阵便可

  4. [num]=xlsread(\'C:\Users\Administrator\Desktop\test\a.xls\')

    MATLAB读取excel文件中的数据

    eg: [data,text] = xlsread(\'H:\张教师研究项目\不同波导尺寸下,不同slot横向狭缝参数s1s2\0000_700_450bc(10,10,200).xlsx\',1,\'A5:H25\');

读取指定sheet中的数据

如果想读取excel中的第二个sheet中的数据,可以输入下面命令

[num]=xlsread(\'C:\Users\Administrator\Desktop\test\a.xls\',2)

MATLAB读取excel文件中的数据

MATLAB读取excel文件中的数据

读取指定单元格中的数据

[num]=xlsread(\'C:\Users\Administrator\Desktop\test\a.xls\',2,\'A2:C5\')

MATLAB读取excel文件中的数据

参考网址:https://blog.csdn.net/qq_38826019/article/details/81184811