function featuresWaves=getSomeAddedWaveletFeatures(ecg,Rs)
% function getSomeAddedFeatures(ecgBeat)
% As=[];Ds=[];
ca1=zeros(1,length(Rs));ca2=zeros(1,length(Rs));ca3=zeros(1,length(Rs));ca4=zeros(1,length(Rs));
ca5=zeros(1,length(Rs));ca6=zeros(1,length(Rs));ca7=zeros(1,length(Rs));ca8=zeros(1,length(Rs));
da1=zeros(1,length(Rs));da2=zeros(1,length(Rs));da3=zeros(1,length(Rs));da4=zeros(1,length(Rs));
da5=zeros(1,length(Rs));da6=zeros(1,length(Rs));da7=zeros(1,length(Rs));da8=zeros(1,length(Rs));
for k=1:length(Rs)
    ecgBeat=ecg(max(1,Rs(k)-100):min(Rs(k)+100,end));
    %     [A,D] = dwt(ecgBeat,'db6');
    %     As(k,:)=abs(A(1:8));
    %     Ds(k,:)=abs(D(1:8));
    %     [C,L] = wavedec(ecgBeat,5,'sym4');
    % Extract the level-3 approximation coefficients. Plot the original signal and the approximation coefficients.
    
    % Lev = 3;
    % a3 = appcoef(C,L,'sym4',Lev);
    [c,l] = wavedec(ecgBeat',8,'db4');
    ca1(k)=mean(abs(appcoef(c,l,'db4',1)));ca2(k)=mean(abs(appcoef(c,l,'db4',2)));
    ca3(k)=mean(abs(appcoef(c,l,'db4',3)));ca4(k)=mean(abs(appcoef(c,l,'db4',4)));
    ca5(k)=mean(abs(appcoef(c,l,'db4',5)));ca6(k)=mean(abs(appcoef(c,l,'db4',6)));
    ca7(k)=mean(abs(appcoef(c,l,'db4',7)));ca8(k)=mean(abs(appcoef(c,l,'db4',8)));
    

    da1(k)=mean(abs(detcoef(c,l,1)));da2(k)=mean(abs(detcoef(c,l,2)));
    da3(k)=mean(abs(detcoef(c,l,3)));da4(k)=mean(abs(detcoef(c,l,4)));
    da5(k)=mean(abs(detcoef(c,l,5)));da6(k)=mean(abs(detcoef(c,l,6)));
    da7(k)=mean(abs(detcoef(c,l,7)));da8(k)=mean(abs(detcoef(c,l,8)));
end
ca1=abs(ca1);ca2=abs(ca2);ca3=abs(ca3);ca4=abs(ca4);ca5=abs(ca5);ca6=abs(ca6);ca7=abs(ca7);ca8=abs(ca8);
da1=abs(da1);da2=abs(da2);da3=abs(da3);da4=abs(da4);da5=abs(da5);da6=abs(da6);da7=abs(da7);da8=abs(da8);
% featuresWaves=[mean(As),mean(Ds),std(As),std(Ds)]; %32
featuresWaves=[mean(ca1),mean(ca2),mean(ca3),mean(ca4),mean(ca5),mean(ca6),mean(ca7),mean(ca8),...
    mean(da1),mean(da2),mean(da3),mean(da4),mean(da5),mean(da6),mean(da7),mean(da8),...
    std(ca1),std(ca2),std(ca3),std(ca4),std(ca5),std(ca6),std(ca7),std(ca8),...
    std(da1),std(da2),std(da3),std(da4),std(da5),std(da6),std(da7),std(da8)];
%use ecg baseline removed

