12-1 Excel 檔?????

bAڭ̱Ng`ϥ test01.xls ӶidһAɮצ󥻮ѪdҥСAɮ׹ϥܫAi}Ҧ Excel ɮסAepUG

Aڭ̥iHϥ xlsfinfo OŪX@ Excel ɮתTθ̭u@]Sheets^W١AO榡pUG

[fileType, sheets] = xlsfinfo(xlsFile)

䤤 xlsFile O Excel ɮצW١AҶǦ^ܼƦӡA䤤 fileType OɮA sheets h]tW١AdҦpUG

Example 1: 12-PExcelպX/xlsfInfo01.mxlsFile='test01.xls'; [fileType, sheets] = xlsfinfo(xlsFile)fileType = Microsoft Excel Spreadsheet sheets = 'Sheet1' 'Sheet2' 'Sheet3' 'Position'

YnŪXu@eAiHϥ xlsread OAdҦpUG

Example 2: 12-PExcelպX/xlsread01.mxlsFile = 'test01.xls'; [number, text, rawData] = xlsread(xlsFile)number = 1.0000 6.3000 2.3000 2.3000 7.0000 NaN 3.0000 8.3000 4.7000 4.7000 9.0000 NaN 5.0000 NaN 3.8000 text = '' 'C2' '' '' '' 'pi' 'yes' '' rawData = [ 1] [6.3000] [2.3000] [2.3000] [ 7] 'C2' [ 3] [8.3000] [4.7000] [4.7000] [ 9] 'pi' [ 5] 'yes' [3.8000]

bWzdҤAѩåwu@W١AҥH xlsread |DŪJĤ@Ӥu@ơC~Aѩu@ƥiHOƭȩΦrAҥH xlsread ҶǦ^Tܼ number, text, rawDataAONu@ƭȸơBrơBHΩҦơC

ƹW xlsread \ܧAڭ̤]iHϥ xlsread ŪXY@Ӥu@@ΥơAdҦpUG

Example 3: 12-PExcelպX/xlsread02.mxlsFile = 'test01.xls'; B = xlsread(xlsFile, 'Sheet2') % ŪX 'Sheet2' C = xlsread(xlsFile, 2, 'A2:B4') % ŪXĤGӸպ A2:B4 B = 26 22 42 41 87 32 24 53 C = 42 41 87 32 24 53

bWzdҤAڭ̥ϥ xlsread ŪX Sheet2 u@ơAMAwuŪXY@ӯSwϰ쪺ơAwϰ쬰 A2:B4A䤤 A:B NĤ@MGA 2:4 NĤGĥ|CC

bu@Aڭ̸g`ϥβĤ@CxsTALCӦsƭȸTAo@Sw榡u@Axlsread OۦP_榡êXƭȸƤrAdҦpUG

Example 4: 12-PExcelպX/xlsread03.mxlsFile = 'test01.xls'; [numericData, headerText] = xlsread(xlsFile, 'Position')numericData = 11 11 12 14 13 19 14 26 15 35 headerText = 'Time (sec)' 'Position (m)'

bWzdҤAnumericData ]tĤGCH᪺ƭȸơA headerText h]tĤ@CrC

Hint
xlsread ]iHϥηƹӿnŪu@ϰAwԱAiJuhelp xlsreadvC


MATLAB{]pGig