In: Computer Science
One spss is the interval width the same thing as the bind width? If not how do I edit bin width?
Hello,
You can use the doc histc function to edit the bin width.
Basic code for this is below. Hope you can refer from this.
%# compute center of bins (used as x-coord for labels)
bins = ( edges(1:end-1) + edges(2:end) ) / 2;
%# histc
[counts,binIdx] = histc(DATA, edges);
counts(end-1) = sum(counts(end-1:end)); %# combine last two bins
counts(end) = []; %#
% %# plot histogram
bar(edges(1:end-1), counts, 'histc')
for c=1:numel(counts)
if counts(c)~=0
text(bins(c), counts(c)+0.3, num2str(counts(c)), 'FontWeight','bold', 'FontSize',8, ...
'VerticalAlignment','bottom', 'HorizontalAlignment','center');
end
end
set(gca,'ylim',[0 max(counts)+1/10*(max(counts))]); %adjust ymax
end
Thanks