This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
scientificComputing/projects/project_fano_slope/solution/counthist.m

12 lines
325 B
Matlab

function [counts, cbins] = counthist(spikes, tmin, tmax, T, cmax)
tbins = tmin+T/2:T:tmax;
cbins = 0.5:cmax;
counts = zeros(1, length(cbins));
for k = 1:length(spikes)
times = spikes{k};
n = hist(times((times>=tmin)&(times<=tmax)), tbins);
counts = counts + hist(n, cbins);
end
counts = counts / sum(counts);
end