Also, to remove the annoyance of inexact case matches when you use the any of the HOSA functions, I'd recommend putting this line of code at the top of your script:

Disclaimer: In the end I could not find any FEX submission that gave the correct outputs for the wide range of test-cases that I tried, so I ended up writing my own function. You can find it here:
http://www.mathworks.com/matlabcentral/fileexchange/33174

While it claims to be suitable for "publication-quality plots", the lack of the space character between the coefficient and the prefix means that this submission actually does not follow the SI standard. It also entirely lacks the prefixes y, z, a, f, p, n, u, m, P, E, Z, and Y. And while it gives some examples, the example on line 20 "class labels" shows a basic misunderstanding between Command Syntax and Function Syntax in MATLAB:
http://www.mathworks.com/help/matlab/ref/syntax.html

The code could be much simpler: the use of (slow) "repmat" is not required (just use the format string itself, eg: '%d k', etc), and that whitespace removal code is bizarre: why not simply "strtrim(xtick)" ?. Precision control, returning my NaN values, an H1 line and input checking would be nice too!

Simple and intuitive. This was definitely missing in matlab!

Following improvements could be made:
1. Handle start and end of range in case where it is not exactly on a sample point
2. Check that x is monotonically increasing and resort vectors if necessary.

There is a BUG in the calculation of the index of the upper bound. You must call the min() function to find the correct index, not the max() function.