% Unit 2 (MATLAB Course @ UAM)
% (c) Alexander Knebe

%============================
% switch for unit conversion
%============================
clear all
clc

x    = input('please give a number: ');
unit = input('please give the unit of this number ("meter" or "inch"): ','s');

switch unit 
    case 'inch'
        y = x/39.3701        % convert to meter 
    case 'meter' 
        y = x*39.3701        % convert to inch
    otherwise 
        disp(['unknown units:' unit]) 
end