Quick unit conversion utilities for matlab
This repository contains several utilities for flexible unit conversion in matlab.
The current functions are:
- cvlength - Length unit conversions (mm, in, m, etc.)
- cvangle - Angle unit conversions (rad, deg, arcseconds, etc.)
- cvdigital - Digital storage unit conversions (bytes, kilobytes, bits, etc.)
- cvarea - Area unit conversions (sqm, sqft, acre, etc.)
All functions have three inputs:
valIn(double, any size) - The value(s) you want to convertunitIn(char) - The name of the unit the value(s) are currently in. This is flexible, as in 'mm', 'millimeter', and 'millimeters' will all work.unitOut(char) - The name of the unit the value(s) should be converted too. LikeunitIn, this is also flexible.
All functions have one output:
valOut(double, same size asvalIn) - The converted values.
cvlength supports units in waves at any wavelength. To specify a unit in waves, the format is:
'wv' + value + units(examples wv1.0um | wv632.8nm | wv0.55microns)- Example:
valInNm = cvlength(valInWaves,'wv632.8nm','nm');