Error using matlab.ui.control.internal.model.AbstractNumericComponent/set.Value (line 111) 'Value' must be a double scalar.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I'm working on an app and I keep getting the message: Error using matlab.ui.control.internal.model.AbstractNumericComponent/set.Value (line 111) 'Value' must be a double scalar.
Here is the portion of my script that gets the error:
syms x
eqn = log(molD/1)==((1/alphaAB)*...
(log((x*(1-xi))/(xi*(1-x)))))+...
log((1-xi)/(1-x));
xD = solve(eqn,x);
app.xDmolfrField.Value = xD; %this line gets the error
app.ximolfrField.Value = xi-xD;
Then I inserted the "double()" to correct it but I still get the same error.
Here's my edited script:
syms x
eqn = log(molD/1)==((1/alphaAB)*...
(log((x*(1-xi))/(xi*(1-x)))))+...
log((1-xi)/(1-x));
xD = solve(eqn,x);
app.xDmolfrField.Value = double(xD); %this line still gets the error
app.ximolfrField.Value = xi-double(xD);
I need this as soon as possible... thank you in advance!
0 Kommentare
Antworten (1)
Walter Roberson
am 7 Aug. 2021
molD = rand()
alphaAB = 5*rand()
xi = rand()
syms x
eqn = log(molD/1)==((1/alphaAB)*...
(log((x*(1-xi))/(xi*(1-x)))))+...
log((1-xi)/(1-x))
xDn = vpasolve(eqn,x)
xD = solve(eqn,x)
When you run out of memory, there would be no answer...
Even if you do not run out of memory, it is pretty likely that it will not be able to come up with an exact solution.
vpasolve() does not have any problem with the situation though.
5 Kommentare
Walter Roberson
am 7 Aug. 2021
So the vpasolve failed. Possibly one of the inputs is empty, or perhaps it just cannot find a solution. You should attach a mat file with the values of your variables. (class of variables and all digits might be important so please do not just show the variables in text form)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!