clear
A = dir(fullfile('E:\2007\','*.dat'));
Leng=length(A);
B=zeros(1,Leng);
for i=1:Leng
SB=strcat('E:\2007\',A(i).name)
file_name{i} =SB;
temp=load (file_name{i});
hei=file_name{i}(:,3);
ph=file_name{i}(:,4);
nn=length(hei);
for i=2:nn
x=(hei(i)-hei(i-1))/(ph(i)-ph(i-1))
if(x<-157)
csvwrite('E:\2007\b.txt',x)
end
end
end
为什么我的代码只执行了第一个循环 只能输出文件名