File Exchange

image thumbnail

xunits, yunits and zunits.m (Jul 2014)

Add unit (and prefix) to your axis labels.

0 Downloads

Updated 07 Jul 2014

View License

When you require to write the units of your x-axis values, you use the XLABEL function.
Now you can use XUNITS to add them right with the labels. And, if you like it, it could use International System Units prefixes instead of the scientific notation.

Besides, you get the same format for all the numbers (check the Screenshot).

It works for log scale as well as the linear one, and includes YUNITS and ZUNITS functions.

Finally, it works after zooming or panning.

Enjoy it!

Comments and Ratings (1)

Jan

I did not run it yet, butthe code looks really nice an clear. The documentation is useful and considers all of the Matlab standards. The comments in the code are meaningful, such that the user can understand, what is going on.

I would avoid calling an anonymous function in the CASE conditions and prefer hard coding. Then it would become clear, if 'deca' is prefered to 'deci' due to the initial leading 'dec'.

There is a typo in 'mili', which needs a 2nd 'l'. The three functions are almost equal, so it could be worth to combine them to improve the maintainability. E.g. that YUNITS calls XUNITS with an additional input argument to determine the axis.

Updates

1.1.0.0

Just added some TAGs.

MATLAB Release Compatibility
Created with R2013b
Compatible with any release
Platform Compatibility
Windows macOS Linux