I'm trying input values to find area, and then ask a yes or no question to test more values afterwards. However, I'm having a hard time incorporating the while loop with the yes or no statement. Any help is appreciated.
base = input('enter base of beam');height = input('enter height of beam');A = base*heightdisp(['The area of the beam is= ', num2str(A)])choice = questdlg('would you like to try other values?',... 'Choose',... %the 'No' button does not appear, am I using it incorrectly?
'Yes','No');%See if the user would like to try more values:
% Read new data
%Starting the while loop here is where I have a problem, even if I assigned a random value to 'yes' or 'no' - doesn't work
switch choice case 'Yes' base = input('enter base of beam'); height = input('enter density of beam');A = base*heightdisp(['The area of the beam is= ', num2str(A)])% Repeat until user chooses 'No'
case 'No' disp('YAY! You finished you calculation!')end %switch
Best Answer