MATLAB: Labels on the contour have too many digits

contour

How can I set the precision of the numbers on my contour plot? Now the clabels are like: 1.29567, I would like to have it rounded like: 1.3.
Thanks

Best Answer

I have done the following and it works perfectly:
[c,h]=contourf(X,Y,H); texth=clabel(c,h,'manual','fontsize', 20); for i=1:size(texth) textstr=get(texth(i),'String'); textnum=STR2DOUBLE(textstr); textstrnew=sprintf('%0.3f', textnum) set(texth(i),'String',textstrnew); end
Related Question