x = input('enter the number ') y = input('enter the type of unit you want to convert from ') % switch(y) % case 'in' % disp('you have ') % x*25.4 % disp('mm') % Normally don't use if y=='in' % Normally use strcmp(y,'in') % In switch, it ends up using strcmp behind the scenes % case 'ft' % disp('you have ') % x*0.305 % disp('meters') % end % Formatted Output - used to display info in more organized and clear way % fprintf(format, data) % Use backslashes (\) to go down a line % '%f' is used as a place-holder for inputs or outputs switch(y) case {'in', 'inch', 'inches'} fprintf('your %f inches is %f millimeters.\n',x,x*25.4) case {'ft', 'foot', 'feet'} fprintf('you %f feet is %f meters\n',x, x*0.305) end % Use { and } to allow for more than one possibility in a case % load filename - puts into a matrix % This file needs to have just numbers in it % Record data in notepad and save using "____.t on desktop" % Drag the file from desktop to current directory in MATLAB % load filename