MATLAB: allow integer, non-exponential ylabel or xlabel

For integer xlabel and ylabel (e.g. 362093) put the following line after you set xlabel or ylabel:

set(gca,'YTickLabel',sprintf('%7d|',get(gca,'YTick')))

The %7d means I want up to 7 integer digits on my y-axis.

MATLAB’s default behavior, which Mathworks says is currently not changeable, is to put exponential format into xlabel and ylabel for large numbers–even integers.

Categories:

Updated:

Leave a Comment