MATLAB: Error is “ Values must be a double sclar within the range of limits”

app designermatlab gui

I am designing a GUI for calculating weight and wing loading of an aircraft. But when I am executing the below code I am getting an error that states “ Values must be a double sclar within the range of limits”. I have attached an image showing the exact line where this error is occuring. Any help to resolve this issue is highly appreciated.
h=app.AltitudehinkmEditField.Value;
v=app.FlightvelocityinmsEditField.Value;
m=app.MassoftheAircraftinkgEditField.Value;
s=app.WingAreainm2EditField.Value;
ar=app.AspectRatioEditField.Value;
e=app.OswaldsEfficiencyFactoreEditField.Value;
if h<11
tratio=(1-(h/44.331));
d=1.225*(tratio)^4.256;
end
if h==11
d=0.36392
end
if h>11
d=0.036392*exp((-9.80665*([h*1000]-11000))/(287.05287*216.65));
end
q=0.5*d*1.225*v^2;
k=1/(3.14*ar*e)
w=9.81*m;
wl=w/s;
app.Densityinkgm3athkmEditField.Value=d;
app.WeightofTheAircraftinkgEditField.Value=w;
app.Wingloadinginkgm2EditField.Value=wl;
app.DynamicPressureinPaEditField.Value=q;
app.KEditField.Value=k;
rc(app,h,v,m,s,ar,e)

Best Answer

From the math I see, I suspect w1 is a double scalar. Still, you should make sure that is the case. If so, that means the error is likely due to w1 exceeding the limits you have secified for your edit field. Return to app designer and inspect the lmits of Wingloadinginkgm2EditField. Compare those to the value of w1.