function datfilt = lowpassfilt(dat,fc,srate)

if(iscell(dat))
    dat = cell2mat(dat);
end
datfilt= dat;

filter_lp = designfilt('lowpassiir','PassbandFrequency',fc+10,'StopbandFrequency',fc+50,'PassbandRipple',1,'StopbandAttenuation',60,'SampleRate',srate);

for i=1:size(dat,1)
    temp = dat(i,:);
    temp_DCsub = temp - nanmean(temp);
    temp_DCsub_pad = [zeros(1,1000) temp_DCsub zeros(1,1000)];
    temp_DCsubfilt = filtfilt(filter_lp,temp_DCsub_pad);
    datfilt(i,:) = temp_DCsubfilt(1001:1001+size(dat,2)-1);
end

end