Error using matlab.ui.control.internal.model.AbstractNumericComponent/set.Value (line 111) 'Value' must be a double scalar.
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Walter Roberson
2021-8-7
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 个评论
Walter Roberson
2021-8-7
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)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!