Units Conversion Toolbox
Updated 25 Jan 2012
Have you ever needed to convert horse power to watts but can't remember the conversion factor? How many inches light travels in a microsecond? This toolbox is designed to make getting these answers much easier.
The "unit" statement attaches units to a variable. For example,
returns the answer in International (SI) units. If you would rather have you answer in feet it can be converted to feet by
Variables created by the "unit" statement can operated on by these operators:
Unary plus, Unary minus, +,-,*,.*,/,\,./,.\,^,.^,',.'
Variables are also supported by triginometric,hyperbolic, and exponential functions and can be compared by
==, ~=, >, <, >=, and <=
Special plotting routines are available for plotting variables with units. These are:
plot, semilogx, semilogy, and loglog
The toolbox appears in the html help screens and has "GettingStarted', "User Guide", and function help screens.
Just down load the tool box to the directory of you choice and set the Matlab path to include this directory. To verify operation, type
If you get this result, you are all set!
John McDermid (2023). Units Conversion Toolbox (https://www.mathworks.com/matlabcentral/fileexchange/29621-units-conversion-toolbox), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired: Unit Converters, kview - Interface for signal/data easy visualization and processing
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
This update corrects the addition and subtraction of dimensionless quantities (previously reported an error) and also corrects the definition of a weber.
I made an omission on the last submission and no file (or the old file) was attached. This is the correct file!
This update was submitted and approved but did not end up in Matlab Central. Instead, the old one was there.
This program has been updated to resolve a problem that appeared in R2011b.