if app.ShapeDropDown.Value == "Rectangle"
% taking in the dimensions of base and height
b = app.Dimension1EditField.Value;
h = app.Dimension2EditField.Value;
% Catching resulting errors if the input values are invalid
try
if b < 0 || h < 0
error('Negative Dimension(s) Entered')
end
catch
b = 0;
h = 0;
errordlg('Invalid Input');
errID = 'myComponent:inputError';
msgtext = 'Negative Inputs';
ME = MException(errID,msgtext)
end
% Calculate MOI
Ix = (b*(h^3))/12;
Iy = ((b^3)*h)/12;
% Displau the MOI on the table
d = {'Base',b, RegUnit;'Height',h,RegUnit;'Ix',Ix, CalcUnit;'Iy',Iy, CalcUnit'};
fig = uifigure('Position',[100 100 752 250]);
uit = uitable('Parent',fig,'Position',[25 50 700 200]);
uit.Data = d;
% Create axes for the figure. Axes of figure changes
% depending on base and height entered
app.UIAxes.XLim = [-1 b+1.00];
app.UIAxes.YLim = [-1 h+1.00];
%Polar axes
XX = linspace(b/2, Ix, 500);
YY = linspace(h/2, Iy, 500);
% % Create a vector that would span the X & Y direction
% positioned at the center of base and height
IXline = ones(1,500)*h/2;
IYline = ones(1,500)*b/2;
% Graph the rectangular shape on the axes
rectangle(app.UIAxes,'Position',[0 0 b h])
hold(app.UIAxes);%hold on
% plot the polar axes
plot(app.UIAxes,XX,IXline, 'r')
plot(app.UIAxes,IYline, YY, 'k')
hold(app.UIAxes,'off')