No BSD License  

Highlights from
UNITS conversion

from UNITS conversion by Riccardo Meldolesi
A robust and simple to use unit conversion framework that takes drastically reduce the number of "un

unit(stru);
function this = unit(stru);

% Created by RICCARDO MELDOLESI, November 2007
%
% rmeldolesi@ptlengines.com

if nargin < 1
   stru = makeEmptyStruct;
   this = class(stru,'unit');
else
   if isa(stru,'unit')
      this = stru;
%    elseif isstruct(stru)
%       this = class(stru,'unit');
%    end
   else
      error('unexpected option')
   end
end

% -----------------------------------------
function stru = makeEmptyStruct

stru.name  = '';
stru.value = 1;

Contact us at files@mathworks.com