'Value' must be a double scalar within the range of 'Limits'.

20 views (last 30 days)
Mateo Armas
Mateo Armas on 6 Jan 2022
Answered: Navya Singam on 11 Jan 2022
Im runnin my App Designer and I got error by error, the last i got i didn't know what to do, hope u guys can help me please.
yinitial = 0.01;
yn(1) = yinitial;
in=1;
dyn(1) = 1e-2;
while (abs(dyn(in))>1e-4)
An(in) = app.b.Value*yn(in)+app.z.Value*(yn(in))^2;
Tn(in) = app.b.Value+2*app.z.Value*yn(in);
Pn(in) = app.b.Value+2*(app.z.Value^2+1)^(0.50)*yn(in);
Rn(in) = An(in)/Pn(in);
Dn(in) = An(in)/(app.b.Value+2*app.z.Value*yn(in));
fn(in) = -app.Q.Value*sqrt(app.S.Value)*An(in)*Rn(in)^(2/3)*app.n.Value^(-1);
ffn(in) = (sqrt(app.S.Value)*app.n.Value^(-1))*((Rn(in)^(2/3)*Tn(in))+(Tn(in)/Pn(in))-((2*yn(in)*Rn(in))/Pn(in)));
yn(in+1) = yn(in)-fn(in)/ffn(in);
dyn(in+1) = -fn(in)/ffn(in);
in=in+1;
end
Calado_Normal=yn(in);
Areah = (app.b.Value+(app.z.Value*Calado_Normal))*Calado_Normal;
Vel = app.Q.Value/Areah;
T = app.b.Value+(2*app.z.Value*Calado_Normal);
F = Vel/((9.81*(Areah/T))^0.5);
Alt = round(Calado_Normal,1)+0.3;
app.V.Value = Vel;
app.CN.Value = Calado_Normal;
app.FR.Value = F;
app.A.Value = Alt;
app.AH.Value = Areah;
app.E.Value = T;
Error is in line 'Vel'
Error using matlab.ui.control.internal.model.AbstractNumericComponent/set.Value (line 185)
'Value' must be a double scalar within the range of 'Limits'.
Error in app1/CalcularButtonPushed (line 61)
app.V.Value = Vel;
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 410)
Error while evaluating Button PrivateButtonPushedFcn.

Answers (1)

Navya Singam
Navya Singam on 11 Jan 2022
Hi,
The error says,
app.V.Value = Vel
The value the component 'V' in the App Designer expects a double scalar value and also expects the value to be within the range of the limits. So, the value it is being assigned is not within the limits.
Numeric components in the App Designer have range limits specified. So the value it expects should lie with in the limits. To change the limits, you may click on the component in the design view and you can find the Limits in the value section. Programmatically, you can change it using the app.V.Limits=[lower,upper]
Refer limits to know more about the Limits of the Numeric edit field in App Designer

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by