function averageDiff=calculateAverageDiff(QRS,QRS1,QRS2,QRS3,QRS4,QRS5)
cqrts=length(QRS);
cqrts1=length(QRS1);
cqrts2=length(QRS2);
cqrts3=length(QRS3);
cqrts4=length(QRS4);
cqrts5=length(QRS5);

averageDiff=200;
if (cqrts)>2
    diff1=abs(diff(QRS));
    averageDiff=median(diff1);
end
averageDiff1=200;
if (cqrts1)>2
    diff1=abs(diff(QRS1));
    averageDiff1=median(diff1);
end

averageDiff2=200;
if (cqrts2)>2
    diff1=abs(diff(QRS2));
    averageDiff2=median(diff1);
end

averageDiff3=200;
if (cqrts3)>2
    diff1=abs(diff(QRS3));
    averageDiff3=median(diff1);
end

averageDiff4=200;
if (cqrts4)>2
    diff1=abs(diff(QRS4));
    averageDiff4=median(diff1);
end

averageDiff5=200;
if (cqrts5)>2
    diff1=abs(diff(QRS5));
    averageDiff5=median(diff1);
end


averageDiff=round(averageDiff);
averageDiff1=round(averageDiff1);
averageDiff2=round(averageDiff2);
averageDiff3=round(averageDiff3);
averageDiff4=round(averageDiff4);
averageDiff5=round(averageDiff5);

averageDiff=mean([averageDiff,averageDiff1,averageDiff2,averageDiff3,averageDiff4,averageDiff5]);
if isnan(averageDiff)
    averageDiff=200;
end
averageDiff=round(averageDiff);