To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016
I'm trying to create a code that calculates an output in one unit but displays the answer in six different unit (the answer is converted to different units). I have a menu command so that the user can choose from the six different units but I need a switch case as my logical structure. I'm completely lost on how to write the switch case (I'm very, very new to matlab, so forgive my ignorance).
choice = menu('Choose a unit','in','ft','yd','m','cm','mm');
R = input('Input a value for the radius:');
result = (pi*R^2);
case 'in' result = pi*R^2;
case 'ft' result = result/12;
case 'yd' result = result/36;
case 'm' result = result * .0254;
case 'cm' result = result * 2.54;
case 'mm' result = result * 25.4;
This was my first attempt that failed miserably, so any help would be appreciated.
No products are associated with this question.