MATLAB运行错误——帮忙解疑,谢谢
clc;H=fopen('D:\vf\data used\422VF_15S_1.txt','r');
[X,C]=fscanf(H,'%f',[1,inf]);
st=fclose(H);
B=resample(X,90,250);
subplot(2,1,1)
plot(X)
subplot(2,1,2)
plot(B)
%write to file
H=fopen('D:\ vf\data used\422VF_16S_1.txt','w');
fprintf(H,'\n%f ',B);
fclose(H);
H=fopen('D:\ vf\data used\422VF_16S_1.txt','r');
[X,C]=fscanf(H,'%f',[1,inf]);
st=fclose(H); %每一秒种的最大值 共n段 总长6n秒 (每秒90hz)
for i =0:(C/90-1)
N(i+1) = max(X(i*90+1:(i+1)*90));
end
%每个窗口的ISOL
for i =0:(floor(C/540)-1)
ISOL(i+1) = mean (X(i*540+1:(i+1)*540));
end
%每个窗口的AMVP
for i =0:(floor(C/540)-1)
AMVP(i+1) = mean (N(i*6+1:(i+1)*6));
End % 阈值
Threshold=0.75*(AMVP-ISOL) %最高 最低 阈值
HIGH = (ISOL + Threshold)
LOW = (ISOL - Threshold) %开始求PTABT
U=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
V=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
for i=1:floor(C/540)
U(i) = sum (X((i-1)*540+1:(i)*540)>HIGH(i));
V(i) = sum (X((i-1)*540+1:(i)*540)<LOW(i));
end
PTABT =(U+V)
%开始求 NPC 的值
p = HIGH; % 指定的p,每540个比较的值
q = LOW; % 指定的q,每540个比较的值
% peak = zeros(1,floor(C/540));
N=0 % 记录每540的峰值个数的数组
for i=1:floor(C/540) % 循环开始
tempx = X(540*(i-1)+1:(i)*540);
forj=1:540
if tempx(j)>p(i)
N=N+1;
end
NPC(i) = N;
N=0;
end % 取当前比较的540个数
NPC(i) = lblNum; % 储存当前峰值个数到peak数组
end % 得出解果sinus=1;vt=2 ;vf=3;non=4
for i =1:floor(C/540)
if NPC(i)<9
Result(i) = 1;
elseif PTABT(i)<6
Result(i) = 1;
elseif 6<PTABT(i)<15
Result(i) = 2;
elseif PTABT(i)>15
Result(i) = 3;
else 6<PTABT(i)<15
Result(i) = 4;
end
end
Result