https://github.com/PerezOrtegaJ/Neural_Ensemble_Analysis
Raw File
Tip revision: 9d37fd031dfbdb4eb69faa449d0a6416267a7d4f authored by Jesús Pérez on 28 July 2020, 20:36:58 UTC
Update README.md
Tip revision: 9d37fd0
Divide_Peaks.m
% Divide peak indices in bin
% 
% By Jesús Pérez-Ortega april-2018

function peak_indices_divided = Divide_Peaks(peak_indices, bin)
    peak_indices_divided=peak_indices;
    peaks=max(peak_indices);
    peak_i=1;
    for i=1:peaks
        peak=find(peak_indices==i);
        if(~isempty(peak))
            n_divs=ceil(length(peak)/bin);
            for j=1:n_divs
                ini=peak((j-1)*bin+1);
                if(j==n_divs)
                    fin=peak(end);
                else
                    fin=peak(j*bin);
                end
                peak_indices_divided(ini:fin)=peak_i;
                peak_i=peak_i+1;
            end
        end
    end
end
back to top