I have recently installed Matlab 2014b and some of my earlier graph formatting code does not work anymore. I have several graphs in programmatic gui and when I have a large number to plot, e.g. 15000, the program automatically displays it on the y-axis as 1.14×10^4. I would like to display the y-axis values as 11400 or 11,400. This code used to work with Matlab 2014a:
ax1=handles.fig_results; plot(x1m, y1, x1m, y2, 'parent', ax1); hleg1 = legend('Male population','Female population', 'Location','SouthWest'); xlabel('years', 'FontSize',12,'FontWeight','bold','parent', ax1); ylabel('No of individuals', 'FontSize',14,'FontWeight','bold','parent', ax1); yt = get(ax1,'YTick'); % change the tickmark format
set(ax1,'YTickLabel', sprintf('%.0f|',yt));
When I run this code in Matlab 2014b, now, all the y-tick values are the same: 11000|11100|11200|11300|11400
Is there a way to fix this? Thanks!
Best Answer