rror using matlab.ui.​control.in​ternal.mod​el.Abstrac​tNumericCo​mponent/se​t.Value (line 111) 'Value' must be a double scalar.

1 view (last 30 days)
"rror using matlab.ui.control.internal.model.AbstractNumericComponent/set.Value (line 111)
'Value' must be a double scalar."
I am getting this error message when ever i try running the code. This message after i wrote the last two lines of code, what could it be
Code
% OUTPUT
EqualSums=(SlipAmount/2)+((person1+person2)/2);
SUMPERSON1=EqualSums-Person2Debts;
SUMPERSON2=EqualSums-Person1Debts;
app.DEBTSEditField.Value=SUMPERSON1;
app.DEBTSEditField_2.Value=SUMPERSON2;

Answers (1)

Cris LaPierre
Cris LaPierre on 25 Jan 2021
One of two possible causes.
  1. SUMPERSON2 is not a double (see this question for an example)
  2. SUMPERSON2 is not a scalar. This error is returned if you try to assign a vector of numbers (e.g. [2, 6]);
You can duplicate the error by running the following in MATLAB.
fig = uifigure;
edt = uieditfield(fig,'numeric');
edt.Value = [5 6];
Error using matlab.ui.control.internal.model.AbstractNumericComponent/set.Value (line 111)
'Value' must be a double scalar.
The solution is to make sure SUMPERSON2 is a single numeric value.
edt.Value = 5;

Categories

Find more on Desktop in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!