% delete redundancy in windows inside function localalignmentfull

function [windowsnr2,windowssqpdist2,windowsorsignal2]=delrepeatwinincluded(WindowsNRD,WindowsSeqpdist,WindowsOrSignal)
% delete redundant windows
windowsnr=WindowsNRD;
windowssqpdist=WindowsSeqpdist;
windowsorsignal=WindowsOrSignal;
n=numel(windowsnr(1,:));
m=numel(windowsnr(2,:));
c=n+1;
windowsnr1=windowsnr(1,:);
windowssqpdist1=windowssqpdist(1,:);
windowsorsignal1=windowsorsignal(1,:);
x=n+1;
for i=1:m
    windowsnr1{1,x}=windowsnr{2,i};
    windowssqpdist1{1,x}=windowssqpdist{2,i};
    windowsorsignal1{1,x}=windowsorsignal{2,i};
    x=x+1;
end

k=numel(windowsnr1(1,:));
for i=1:n
    for j=n+1:k
        if numel(windowsnr1{1,i})==numel(windowsnr1{1,j})
        tag=windowsnr1{1,i}-windowsnr1{1,j};
        else
        tag=1;
        end
    if tag==0
       windowsnr1{1,j}=0;
    end
    
    end
    
end
windowsnr2(1:n)=windowsnr1(1:n);
windowssqpdist2(1:n)=windowssqpdist1(1:n);
windowsorsignal2(1:n)=windowsorsignal1(1:n);
for x=n+1:k
    a=sum(windowsnr1{1,x});
    if a~=0 
    windowsnr2{1,c}=windowsnr1{1,x};
    windowssqpdist2{1,c}=windowssqpdist1{1,x};
    windowsorsignal2{1,c}=windowsorsignal1{1,x};
    tablepos(x-n)=(x-n);
    c=c+1;
    end
end


end

