matlab如何从excel表格中读取数据?

如题所述

第一种方法,你可以使用xlsread函数来读取excel中的数据\x0d\x0a\x0d\x0a第二种方法,就是把字符转化为数字,使用函数str2num\x0d\x0a\x0d\x0axlsread的使用\x0d\x0aEXAMPLES:\x0d\x0a1.Defaultoperation:\x0d\x0aNUMERIC=xlsread(FILE);\x0d\x0a[NUMERIC,TXT]=xlsread(FILE);\x0d\x0a[NUMERIC,TXT,RAW]=xlsread(FILE);\x0d\x0a\x0d\x0a2.Getdatafromthedefaultregion:\x0d\x0aNUMERIC=xlsread('c:\matlab\work\myspreadsheet')\x0d\x0a\x0d\x0a3.Getdatafromtheusedareainasheetotherthanthefirstsheet:\x0d\x0aNUMERIC=xlsread('c:\matlab\work\myspreadsheet','sheet2')\x0d\x0a\x0d\x0a4.Getdatafromanamedsheet:\x0d\x0aNUMERIC=xlsread('c:\matlab\work\myspreadsheet','NBData')\x0d\x0a\x0d\x0a5.Getdatafromaspecifiedregioninasheetotherthanthefirst\x0d\x0asheet:\x0d\x0aNUMERIC=xlsread('c:\matlab\work\myspreadsheet','sheet2','a2:j5')\x0d\x0a\x0d\x0a6.Getdatafromaspecifiedregioninanamedsheet:\x0d\x0aNUMERIC=xlsread('c:\matlab\work\myspreadsheet','NBData','a2:j5')\x0d\x0a\x0d\x0a7.Getdatafromaregioninasheetspecifiedbyindex:\x0d\x0aNUMERIC=xlsread('c:\matlab\work\myspreadsheet',2,'a2:j5')\x0d\x0a\x0d\x0a8.Interactiveregionselection:\x0d\x0aNUMERIC=xlsread('c:\matlab\work\myspreadsheet',-1);\x0d\x0aYouhavetoselecttheactiveregionandtheactivesheetinthe\x0d\x0aEXCELwindowthatwillcomeintofocus.ClickOKintheData\x0d\x0aSelectionDialogwhenyouhavefinishedselectingtheactiveregion.\x0d\x0a\x0d\x0a祝你学习愉快!
温馨提示:答案为网友推荐,仅供参考
相似回答