Error using matlab.ui.control.internal.model.AbstractNumericComponent/set.Value (line 111) 'Value' must be a double scalar.
조회 수: 2 (최근 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!