function [theWaves,DBLbadwaves] = removeDBLwaves(theWaves,thresholdPercent,Vmaxs,time)

    [~,p, ~] = size(theWaves);
    hasOneThresh=zeros(p,1);
    for j=1:p
        
        %If any of channels 1,2 or 3 display 2+ threshold breaches
        %[thcount1,~,~,~] = findThresholds(theWaves(:,j,1),thresholdPercent*Vmaxs(j,1),time);
        [thcount2,~,~,~] = findThresholds(theWaves(:,j,2),thresholdPercent*Vmaxs(j,2),time);
        %[thcount3,~,~,~] = findThresholds(theWaves(:,j,3),thresholdPercent*Vmaxs(j,3),time);
        if ( thcount2 == 1 )
            %denotes 1 thresh present
            hasOneThresh(j) = 1;
        end
    end
    

    
    theWaves1=theWaves(:,logical(hasOneThresh),1);
    theWaves2=theWaves(:,logical(hasOneThresh),2);
    theWaves3=theWaves(:,logical(hasOneThresh),3);
    theWaves4=theWaves(:,logical(hasOneThresh),4);
    
    % waves that have double pulses go in DBLbadwaves
    badwaves1=theWaves(:,~logical(hasOneThresh),1);
    badwaves2=theWaves(:,~logical(hasOneThresh),2);
    badwaves3=theWaves(:,~logical(hasOneThresh),3);
    badwaves4=theWaves(:,~logical(hasOneThresh),4);    
    
    clear theWaves;
    
    theWaves(:,:,1) = theWaves1;
    DBLbadwaves(:,:,1) = badwaves1;
    clear theWaves1;
    clear badwaves1;
    theWaves(:,:,2) = theWaves2;
    DBLbadwaves(:,:,2) = badwaves2;
    clear theWaves2;
    clear badwaves2;
    theWaves(:,:,3) = theWaves3;
    DBLbadwaves(:,:,3) = badwaves3;
    clear theWaves3;
    clear badwaves3;
    theWaves(:,:,4) = theWaves4;
    DBLbadwaves(:,:,4) = badwaves4;
    clear theWaves4;
    clear badwaves4;