MATLAB: Display values as labels at the tips of serie of bars.

bar values labels

In Matalb R2019b, to display values as labels at the tips of serie of bars, we can use :
xtips1 = b(1).YEndPoints + 0.3;
ytips1 = b(1).XEndPoints;
labels1 = string(b(1).YData);
text(xtips1,ytips1,labels1,'VerticalAlignment','middle')
These commands do not work in Matlab R2018b. Do you have solution for this problem.
Thanks,