function PeakIndex=datafusion(wave,BPIndex,differ,thrm)
lenw=length(wave);
Peakindex=[];
if BPIndex(1)>=differ-1 %ECGR波波峰先出现的情况  原来是differ-15；2015.1.14
    Peakindex=BPIndex-differ;
else                    %BP波峰先出现的情况
    Peakindex=BPIndex(2:end)-differ;
end
PeakIndex=findpeak(wave,Peakindex,thrm);
lenP=length(PeakIndex);
Temp1=diff(PeakIndex);
Temp2=floor(mean(Temp1));
minP=min(wave(PeakIndex));
if lenw-PeakIndex(lenP)>0.88*Temp2 %R波最后多一个时，进行补漏,0.75改成0.88,2015.1.14
    PeakIndex(lenP+1)=PeakIndex(lenP)+Temp2;
    [~,f]=max(wave(PeakIndex(lenP)+50:lenw));
    PeakIndex(lenP+1)=PeakIndex(lenP)+50-1+f;
    if wave(PeakIndex(lenP+1))<minP*0.7
        PeakIndex(lenP+1)=[];
    end
end
end