怎样将Excel中的数据导入MATLAB 能不能举个例子

来源:百度知道 编辑:UC知道 时间:2024/06/16 00:27:12
我想将Excel中的数据导入MATLAB,xslread函数试了不行,请问怎样能快速简便的将数据导入?最好举个例子。。谢谢。。。

Example -- Importing Data From an Excel Application

Assume that you have an Excel spreadsheet stocks.xls. This spreadsheet contains the prices of three stocks in row 3 (columns 1 through 3) and the number of shares of these stocks in rows 6 through 8 (column 2). Initiate conversation with Excel with the command
channel = ddeinit('excel','stocks.xls')

DDE functions require the rxcy reference style for Excel worksheets. In Excel terminology the prices are in r3c1:r3c3 and the shares in r6c2:r8c2.
Request the prices from Excel:

prices = ddereq(channel,'r3c1:r3c3')

prices =
42.50 15.00 78.88

Next, request the number of shares of each stock:
shares = ddereq(channel, 'r6c2:r8c2')

shares =
100.00
500.00
300.00