MATLAB: Bar plot, value on top

bar plot

Hi This actually works to some extent but the problem is i got all the values for each bar shown on top. So for each bar all the Y values are being shown.
x=[1:2:23]';
y=abs([121 41 20.6 12.5 8.1 5.8 4.4 3.5 3 2.7 2.3 2.1]);
bar(x,y)
text(x,y,num2str(y,'%0.2f'),...
'HorizontalAlignment','center',...
'VerticalAlignment','bottom')
Please tell me what is wrong! Thanks!

Best Answer

x=[1:2:23]';
y=abs([121 41 20.6 12.5 8.1 5.8 4.4 3.5 3 2.7 2.3 2.1]);
bar(x,y)
for i1=1:numel(y)
text(x(i1),y(i1),num2str(y(i1),'%0.2f'),...
'HorizontalAlignment','center',...
'VerticalAlignment','bottom')
end