function [Keeper Reason]= paramFilter(sampling_rate,Interval,window,Ups,startParam,startParam2,finishParam)
% paramFilter(sampling_rate,Interval,riseTable,startParam,startParam2,finishParam)
% lengthParam=5; %seconds

%Convert things from seconds to samples
window = window * (sampling_rate / Interval);
startParam = startParam * (sampling_rate / Interval);
startParam2 = startParam2 * (sampling_rate / Interval);
finishParam = finishParam * (sampling_rate / Interval);

riseTable=zeros(1,ceil(window));
if strcmp(Ups.Status,'No Ups')
    Keeper=0;
    Reason='No Ups';
    return
end
riseTable(Ups.Start:Ups.Finish)=1;
Keeper=0;


for j=1:size(riseTable,2)
    %See if j is after "Rise Start - Begin" but before "Rise Start - End"
    if  j >( round(startParam) +1) && j< ( round(startParam2) +1)
        if riseTable(j)>0 && riseTable(j-1)==0 % input dependant
            Keeper=1;
            start_ind=j;
        end
    else
        Reason='Start Parameter';
    end

    if exist('start_ind','var')
        if j >(start_ind + round(finishParam) )
            if riseTable(j)>0
                Keeper=0;
                Reason='Finish Parameter';
            end

        end
    end
end

if Keeper
    Reason='active';
end

