필터 지우기
필터 지우기

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

조회 수: 3 (최근 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!

답변 (1개)

Walter Roberson
Walter Roberson 2021년 8월 7일
molD = rand()
molD = 0.2452
alphaAB = 5*rand()
alphaAB = 3.1284
xi = rand()
xi = 0.9372
syms x
eqn = log(molD/1)==((1/alphaAB)*...
(log((x*(1-xi))/(xi*(1-x)))))+...
log((1-xi)/(1-x))
eqn = 
xDn = vpasolve(eqn,x)
xDn = 
0.82341997811071473875089180962197
xD = solve(eqn,x)
Error using mupadengine/feval_internal
Out of memory.

Error in sym/solve (line 293)
sol = eng.feval_internal('solve', eqns, vars, solveOptions);
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
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)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by