MATLAB: How to ask the user to input units of either m or in, then have the program keep asking them for units until they input either m or in

check inputuser input

Asks the user the unit of l. The program must accept the following units or keep asking for a unit: a. m b. in

Best Answer

I suggest you use
iChoice = menu('Select a unit', 'inches', 'metres');
This will return 1 for inches and 2 for metres.
Related Question