当前位置:首页>开发>正文

matlab处理excel数据 如何用matlab处理多个excel表格中的数据

2024-01-08 11:29:19 互联网 未知 开发

 matlab处理excel数据 如何用matlab处理多个excel表格中的数据

matlab处理excel数据

clcclear
A=xlsread(E:/data/mydata.xlsx,Sheet1,A1:B15)%假设数据放在E:/data/mydata.xlsx的Sheet1的A1:B15区域。
a=A(:,1)b=A(:,2)
k=find(diff(b)~=0)
ind=a(k)n=length(ind)
B(n 1,3)=0
if b(1)==B(:,1)=[0ind]
B(:,2)=[inda(end)]
B(1:2:end,3)=1
 B(2:2:end,3)=2
elseif b(1)==B(:,1)=[0ind]
B(:,2)=[inda(end)]
B(1:2:end,3)=2
 B(2:2:end,3)=1
else
   error(数据有误)
end
B

运行结果:
B =
     0   100        100   120        120   160        160   220        220   380     1

如何用matlab处理多个excel表格中的数据

biao=D:Program Filesmatlabinfilename.xls
A1=xlsread (biao,Sheet1,AC33:AZ33)
B2=xlswrite(filename.xls,A1,Sheet1,B35:Y35)
这是复制一个excel中的数据粘贴到另一位置。应该会根据自己的需要改吧,不会再问。

最新文章