function [RpeaksPVC] = locatePVCbeats(ecgSig, Rpeaks_pruned)

RpeaksPVC = [];
PVCbeatVec = [];

blCorrected = ecgSig;

ann_res_pruned = find(Rpeaks_pruned == 1);
ann1 = ann_res_pruned;
if(length(ann_res_pruned)>2)
    kv = 1;
    si = find((ann1-80)>0);
    ei = find(ann1+120<length(blCorrected));
    for ind = si(1)+1:ei(end)-1
            sf = max(abs((blCorrected(ann1(ind)-50:ann1(ind)+50))));
            NVbeat(1,:,kv) = (blCorrected(ann1(ind-1)-80:ann1(ind-1)+120))/sf;
            NVbeat(2,:,kv) = (blCorrected(ann1(ind)-80:ann1(ind)+120))/sf;
            NVbeat(3,:,kv) = (blCorrected(ann1(ind+1)-80:ann1(ind+1)+120))/sf;
            kv = kv+1;
    end
end
    
    load('I1_NV_params_5_filDim_3.mat')
    
    [cost, grad, preds] = cnnCost_MC(opttheta,NVbeat,[],numClasses,...
        filterDimX,filterDimY,numFilters,poolDim,'True');
    preds = [ones(si(1),1); preds; ones(length(ann_res_pruned)-ei(end),1)];
    PVCindex = find(preds == 2);
    
    PVCbeatInd = ann_res_pruned(PVCindex);
    
    RpeaksPVC = zeros(size(Rpeaks_pruned));
    RpeaksPVC(PVCbeatInd) = 1;
%     
%     PVCbeatVec = [];
%     k = 1;
%     for idx = 1:length(PVCbeatInd)
%         PVCbeatVec(:,k) = (ecgSig(PVCbeatInd(idx)-50:PVCbeatInd(idx)+130))/max(abs(ecgSig(PVCbeatInd(idx)-60:PVCbeatInd(idx)+150)));
%         k = k+1;
%     end
end
