Watch this Author's files
I know it is an old file and coding standards have changed but this file is over 500 lines of code while it could be half the size
There is a lot of repetition which leads to errors out of copy pasted parts e.g.
elseif length(tickx) == 0;
elseif length(tickposx) == 0;
it is not very good
Excellent function, works really well. I made a few changes that extends this program for semilogx, semilogy, and loglog plots. Check it out here: http://www.mathworks.com/matlabcentral/fileexchange/46431-format-tick-labels--extended-v2-