MATLAB: How to remove a bar from histogram which drawn using ‘hist’ function

digital image processinghistogramMATLAB

hi can anyone help me to remove zeros bar in histogram this is a part of the code . i'm new in matlab so pleas help me
[hCount, hValues] = hist(h(:), 6);
[sCount, sValues] = hist(s(:), 6);
[vCount, vValues] = hist(v(:), 6);
% Plot histograms.
subplot(3, 4, 6);
bar(hValues, hCount);
title('Hue Histogram');
subplot(3, 4, 7);
bar(sValues, sCount);
title('Saturation Histogram');
subplot(3, 4, 8);
bar(vValues, vCount);
title('Value Histogram');

Best Answer

If you want to omit zeros from the bar calculations:
hist(h(h~=0), 6)
Depending on your data, this may omit the bar that contains zero.
If you want to omit bars that have zero height, well, when I try this I don't see anything at those spots. Maybe you could explain some more.