php中文网 | cnphp.com

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 266|回复: 0

批量处理多个excel文件,读出指定单元格数据

[复制链接]

2627

主题

2634

帖子

9336

积分

管理员

Rank: 9Rank: 9Rank: 9

UID
1
威望
0
积分
6587
贡献
0
注册时间
2021-4-14
最后登录
2024-4-26
在线时间
667 小时
QQ
发表于 2022-11-6 22:11:14 | 显示全部楼层 |阅读模式
[mw_shl_code=applescript,true]%功能:批量读出多个excel文件的指定列数据,并从文件名提取输入幅度,绘制输入输出关系图
clc;clear;
s=what;
p=s.path;
file=dir([p,'\test5_and_chip7_cap\vh2.71\DCdata\线性度data\','*.csv']);%拼接路径,读入all文件名
filenum=length(file);%文件数目
data=cell(1003,41); %定义数据大小,1000行,41个文件
for i=1:filenum
name=file(i).name;%文件 名称遍历循环
[Num,Txt,Raw]=xlsread([p,'\test5_and_chip7_cap\vh2.71\DCdata\线性度data\',name]);%读取数据
data([4:1003],i)=Raw([10:1009],15);%赋值:将excel文件的15列的6行到1005行数据赋给data。
temp1(i,=regexp(name,'DC','split'); %分列名字
temp2(i,=regexp(temp1(i,2),'.csv','split'); %二次分列名字
Input(i,1)=str2num(temp2{i,1}{1,1}); %提取输入幅度并赋值

data{1,i}=name;
data{2,i}=mean(cell2mat(data([4:1003],i)));
data{3,i}=std(cell2mat(data([4:1003],i)));
end
plot(Input',cell2mat(data(2,),'r*');
fit=polyfit(Input',cell2mat(data(2,),1)
hold on
Output_fit=polyval(fit,Input);
plot(Input',Output_fit','b--');
title('Input vs Output ','Fontsize',12,'Fontname','Times New Roman');
xlabel('Vinput(V)','Fontsize',10,'Fontname','Times New Roman');
xlim([1.65:2.75]);
ylim([0,5050]);
ylabel('Dout(LSB)','Fontsize',10,'Fontname','Times New Roman');
h=text(2,4000,'$$ V_{input}=\frac{D_{out}+8106}{4812.7}$$');
set(h,'Interpreter','latex','Fontsize',10)[/mw_shl_code]





上一篇:matlab程序:ADC的SNDR,THD,ENOB,SFDR,SNR计算程序
下一篇:ELM算法
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|php中文网 | cnphp.com ( 赣ICP备2021002321号-2 )51LA统计

GMT+8, 2024-4-26 22:44 , Processed in 0.193741 second(s), 38 queries , Gzip On.

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

申明:本站所有资源皆搜集自网络,相关版权归版权持有人所有,如有侵权,请电邮(fiorkn@foxmail.com)告之,本站会尽快删除。

快速回复 返回顶部 返回列表