View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Unit Conversion Tools

4.0 | 2 ratings Rate this file 6 Downloads (last 30 days) File Size: 40.4 KB File ID: #16224 Version: 1.0
image thumbnail

Unit Conversion Tools


Bob Kagy (view profile)


04 Sep 2007 (Updated )

Command line, GUI, & Simulink block to convert physical units

| Watch this File

File Information

Command line, GUI, & Simulink block to convert physical units. It is hoped that relationships between units are specified in an easy to extend manner.
unit_conversion is an m-script that allows one to convert physical units from the command line or a script. It can also provide lists of available transformations.

unit_conversion_gui is a simple graphical interface to unit_conversion.

lib_unit_conversion is a Simulink library block that uses unit_conversion to determine appropriate gains & offsets.


Unit Conversion, Units (Updated), Changeunit, and Unit Conversion inspired this file.

MATLAB release MATLAB 7.4 (R2007a)
MATLAB Search Path
Other requirements As far as I know, the only required product is MATLAB. If you want to use the block, you will also need Simulink. The Simulink library will pick fixed point data types if you have Simulink Fixed Point, but this isn't required to use the block.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
26 Oct 2009 Turner

Turner (view profile)

The unit_conversion for Fahrenheit is incorrect!

Tried: unit_conversion(0, 'degK','degF')=-255.3722
Should be: unit_conversion(0, 'degK','degF')=−459.67
Tried: unit_conversion(0,'degC','degF')=236.2978
Shuld be: unit_conversion(0,'degC','degF')=32

Also added in two more units and included 'in' aka 'inch' as follows :
'unit',{{'mrad','mradian','mil'}},... %T.J. Modified

'unit',{{'moa','MOA'}},... %T.J. Modified


% Finally fixed Fahrenheit with following code:
'gain',5/9,... % kelvin = 5/9 * ( degF - 32 ) + 273.15 = 5/9 * degF - 5/9 * 32 + 273.15
'bias',459.67,... %T.J. modified, %orginal (5/9)*(-32)+273.15

27 Sep 2007 Ruoyu Cheng

Please bear me with one more comment. It will be very helpful if the authors can provide a help file (.pdf) listing the names or abbreviations of the units involved in this program. Thanks.

Comment only
27 Sep 2007 Ruoyu Cheng

It is a good program to handle the conversion between different unit systems. The authors' may notice that there is a small mistake in the mass unit conversion, where the "kilogram" was supposed to be the common unit instead of "gram".
Thanks, really good work!

02 May 2016 1.0

Just going through the update process.

Contact us