%  Convert to SI units 
function [varargout] = SI(varargin)
  J=length(varargin);
  units1=varargin{J};
  for j=1:J-1
    val1=varargin{j};
    switch units1 % check for simple temperature conversion
    case 'C'
      varargout{j}=val1+273.15;
      varargout{J}='K';
      continue;
    case 'F'
      varargout{j}=(val1+459.67)*5/9;
      varargout{J}='K';
      continue;
    case 'R'
      varargout{j}=val1*5/9;
      varargout{J}='K';
      continue;
    end

    EU2SI={'deg',pi/180,'rad';
           'Btu',1055.05585,'J';
           'lbf',4.4482216,'N';
           'cm',0.01,'m';
           'mm',0.001,'m';
           'ft',0.3048,'m';
           'in',0.3048/12,'m';
           'lbm',0.45359237,'kg';
           'bar',1e5,'Pa';
           'atm',101325,'Pa';
           'R',5/9,'K';
           'F',5/9,'K';
           'hr',3600,'s';
           'min',60,'s';
           'L',0.001,'m^3';
           'gal',1/264.172052,'m^3';
           'rad',1,'rad';
           'J',1,'J';
           'N',1,'N';
           'm',1,'m';
           'kg',1,'kg';
           'Pa',1,'Pa';
           'W',1,'W';
           'K',1,'K';
           's',1,'s'};
    [varargout{j} varargout{J}] = ConvertUnits(EU2SI,val1,units1);
  end
  SAME={'J/s','W'};
  varargout{J} = SameUnits(SAME,varargout{J});
end
