function h = grouped_hist(C)

N = length(C);
h = cell(N,1);
% figure;
% hold all
max_x = 0;
for i=1:N
    if ~isempty(C{i})
        h{i} = accumarray(C{i}, ones(size(C{i})))';
        max_x = max(max_x, find(h{i}>0,1,'last') );
    else
        h{i} = 0;
    end
        
end

for i=1:N
   h{i} = padarray(h{i}, [0,max(0,max_x - length(h{i}))],'post'); 
end


end