作者:乔山办公网日期:
返回目录: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;