九色国产,午夜在线视频,新黄色网址,九九色综合,天天做夜夜做久久做狠狠,天天躁夜夜躁狠狠躁2021a,久久不卡一区二区三区

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
matlab打開excel (xlsread、xlswrite)實用方法...

excel數(shù)據(jù)讀取函數(shù):

[num, txt, raw, X] = xlsread(filename, sheet, range)

filename, sheet, range 文件名,sheet名、范圍

num, txt, raw, X 輸出

excel數(shù)據(jù)寫入函數(shù):

[status, message] =xlswrite(filename, M, sheet, range)

filename, M, sheet, range 文件名,數(shù)據(jù)、sheet名、范圍

Examples

Example 1— Reading Numeric Data

The Microsoft Excel spreadsheet file testdata1.xls contains this data:

    1    62    73    84    95   10

To read this data into MATLAB, use this command:

A = xlsread('testdata1.xls')A =1    62    73    84    95   10

Example 2 — Handling Text Data

The Microsoft Excel spreadsheet file testdata2.xls contains a mix of numeric and text data:

    1    62    73    84    95   text

xlsread puts a NaN in place of the text data in the result:

A = xlsread('testdata2.xls')A =1    62    73    84    95   NaN

Example 3 — Selecting a Range of Data

To import only rows 4 and 5 from worksheet 1, specify the range as 'A4:B5':

A = xlsread('testdata2.xls', 1, 'A4:B5')A =4    95   NaN

Example 4 — Handling Files with Row or Column Headers

A Microsoft Excel spreadsheet labeled Temperatures in file tempdata.xls contains two columns of numeric data with text headers for each column:

Time  Temp12     9813     9914     97

If you want to import only the numeric data, use xlsread with a single return argument. Specify the filename and sheet name as inputs.

xlsread ignores any leading row or column of text in the numeric result.

ndata = xlsread('tempdata.xls', 'Temperatures')ndata =12    9813    9914    97

To import both the numeric data and the text data, specify two return values for xlsread:

[ndata, headertext] = xlsread('tempdata.xls', 'Temperatures')ndata =12    9813    9914    97headertext ='Time'    'Temp'
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Examples

Example 1 — Writing Numeric Data to the Default Worksheet

Write a 7-element vector to Microsoft Excel file testdata.xls. By default, xlswrite writes the data to cells A1 through G1 in the first worksheet in the file:
xlswrite('testdata.xls', [12.7 5.02 -98 63.9 0 -.2 56])

Example 2 — Writing Mixed Data to a Specific Worksheet

This example writes the following mixed text and numeric data to the file tempdata.xls:

d = {'Time', 'Temp'; 12 98; 13 99; 14 97};

Call xlswrite, specifying the worksheet labeled Temperatures, and the region within the worksheet to write the data to. xlswrite writes the 4-by-2 matrix to the rectangular region that starts at cell E1 in its upper left corner:

s = xlswrite('tempdata.xls', d, 'Temperatures', 'E1')s =1

The output status s shows that the write operation succeeded. The data appears as shown here in the output file:

Time   Temp12     9813     9914     97

Example 3 — Appending a New Worksheet to the File

Now write the same data to a worksheet that doesn’t yet exist in tempdata.xls. In this case, xlswrite appends a new sheet to the workbook, calling it by the name you supplied in the sheets input argument, 'NewTemp'. xlswrite displays a warning indicating that it has added a new worksheet to the file:

xlswrite('tempdata.xls', d, 'NewTemp', 'E1')Warning: Added specified worksheet.

If you don’t want to see these warnings, you can turn them off with this command:

warning off MATLAB:xlswrite:AddSheet

Now try the write command again, this time creating another new worksheet, NewTemp2. Although the message does not appear this time, you can still retrieve it and its identifier from the second output argument, msg:

[stat msg] = xlswrite('tempdata.xls', d, 'NewTemp2', 'E1');msgmsg =message: 'Added specified worksheet.'identifier: 'MATLAB:xlswrite:AddSheet'
  • No Related Post

from http://www.ariszheng.com/?p=274

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
MATLAB讀寫Excel
matlab中的數(shù)據(jù)導入和導出
xlswrite將數(shù)據(jù)寫入xls文件
matlab讀取excel文件及其數(shù)據(jù)處理
MATLAB向Excel文件寫數(shù)據(jù)
Excel中各種VBA寫法 - 彷徨......豁然開朗 - 博客園
更多類似文章 >>
生活服務(wù)
熱點新聞
分享 收藏 導長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服