乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > 请问matlab如何从excel表格中读取数据,谢谢-matlab逐行读取excel,如何用matlab读取文件

请问matlab如何从excel表格中读取数据,谢谢-matlab逐行读取excel,如何用matlab读取文件

作者:乔山办公网日期:

返回目录:excel表格制作


如果excel文档很小,楼主肯定不会去逐行处理excel文档。所以答题者初步认为楼主的excel文档特别大。特此奉上一点点自己的东西,仅供参考。

clc;clear
numcolumn=100;%文档列数初步定在100列CV
numlines=10000;%行数范围自己定
for i=1:numlines
[~,~,P]=xlsread('a.txt','sheet1',['A',num2str(i),':CV',num2str(i)]);
**********%你对这第i行数据P的处理程序
end


第一种方法,你7a686964616fe78988e69d83331可以使用xlsread函数来读取excel中的数据

第二种方法,就是把字符转化为数字,使用函数str2num

xlsread的使用
EXAMPLES:
1. Default operation:
NUMERIC = xlsread(FILE);
[NUMERIC,TXT]=xlsread(FILE);
[NUMERIC,TXT,RAW]=xlsread(FILE);

2. Get data from the default region:
NUMERIC = xlsread('c:\matlab\work\myspreadsheet')

3. Get data from the used area in a sheet other than the first sheet:
NUMERIC = xlsread('c:\matlab\work\myspreadsheet','sheet2')

4. Get data from a named sheet:
NUMERIC = xlsread('c:\matlab\work\myspreadsheet','NBData')

5. Get data from a specified region in a sheet other than the first
sheet:
NUMERIC = xlsread('c:\matlab\work\myspreadsheet','sheet2','a2:j5')

6. Get data from a specified region in a named sheet:
NUMERIC = xlsread('c:\matlab\work\myspreadsheet','NBData','a2:j5')

7. Get data from a region in a sheet specified by index:
NUMERIC = xlsread('c:\matlab\work\myspreadsheet',2,'a2:j5')

8. Interactive region selection:
NUMERIC = xlsread('c:\matlab\work\myspreadsheet',-1);
You have to select the active region and the active sheet in the
EXCEL window that will come into focus. Click OK in the Data
Selection Dialog when you have finished selecting the active region.

祝你学习愉快!
用matlab的读取excel中数据,可以用xlsread()函数。
例如:
A=xlsread('D:\X.xls','Sheet1','E2:G10')
读取(目标文件夹(D:\)的 X.xls 中的第一工作表的单元格 E2:G10 里的数据赋值给矩阵A。

g = 10;
fnm = 'book1.xls';
for k = 1:g
id = num2str(k+1);
rg = ['A' idnum2str(k+1) ':F' id];
a = xlsread(fnm,'sheet1',rg);

r = % 解方zd;
rg = ['A' idnum2str(k+1) ':B' id];
xlswrite(fnm,r,'sheet2',rg)

end;

相关阅读

关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网