12-2 Excel 檔??寫??

bMATLAB po쪺ơA]iHgJ xls u@AKiƪxsBɩΧ@ϤRCgJu@ҥΨ쪺OO xlswriteA򥻽dҦpUG

Example 1: 12-PExcelպX/xlswrite01.mxlsFile = 'output01.xls'; xlswrite(xlsFile, randn(5)); dos(['start ' xlsFile]);

bWzdҤAڭ̱N@ 5x5 üƯx}gJ Excel ɮoutput01.xls]ѩڭ̨åwu@W١AҥH MATLAB |Nƪgw] Sheet1 u@^Aê}ҦɮסAұo쪺pUG

bϥ xlswrite gJƮɡA]iHwu@W١AάOwgJxsAdҦpUG

Example 2: 12-PExcelպX/xlswrite02.mxlsFile = 'output02.xls'; sheetName='7x7]}'; [status, message] = xlswrite(xlsFile, magic(7), sheetName) xlswrite(xlsFile, {'HWO7x7]}'; date}, sheetName, 'B8:B9'); dos(['start ' xlsFile]);status = 1 message = message: '' identifier: ''

bWzdҤAڭ̱N@ 7X7 ]}gJɮ output02.xls]Ҧ^Ǫ status=1 NgJ\Amessage hOާ@W١^AñNӦr]'HWO7x7]}' HΥثe^OgJ B8:B9 xsAҶ}Ҫ Excel pUG

bU@ӽdҤAڭ̱NۥѸ骺ơ]mɶ^gJ@ Excel ɮסApUG

Example 3: 12-PExcelպX/xlswrite03.mxlsFile = 'output03.xls'; sheetName='mɶܤ'; data={'ɶ (sec)', 'm (m)'}; for i=1:5 data{i+1,1}=i; data{i+1,2}=0.5*9.8*i^2; end [status, message] = xlswrite(xlsFile, data, sheetName); dos(['start ' xlsFile]);

Ҷ}Ҫ Excel ɮצpUG

Hint
  • YnLotus 123պiŪgAiHϥwk1read/wk1writeC
  • Yn@몺rɮ׶ixlsread/xlswrite\AiHϥcsvread/csvwriteHdlmread/dlmwriteOC
  • YndMATLABiHŪUɮ׮榡Aiѡuhelp fileformatsvӨouW䴩C


MATLAB{]pGig