Calculating limits, derivatives, and integrals in AppDesigner
6 次查看(过去 30 天)
显示 更早的评论
Hello, I have a task to write a user interface for calculating limits, derivatives, and integrals.
In each function there is some problem because of which the GUI can not work completely on the user-defined data.
In the usual Matlab command line, everything works flawlessly, but in AppDesigner it does not work.
If someone knows how to do this, please explain.
For input data i'm use text fields.
Here's what I have:
Integrals:
function CalculateButtonPushed(app, event)
syms x
fun=app.integralEditField.Value;
xmin=app.downEditField.Value;
xmax=app.upEditField.Value;
f=int(fun,xmin,xmax);
app.ansIntegralEditField.Value=f;
end
Error: Undefined function 'int' for input arguments of type 'char'.
Limits:
function limcalcButtonPushed(app, event)
syms x
y=app.limitEditField.Value; %(x^3 + 5)/(x^4 + 7)
lim = limit(y);
app.limansEditField.Value=lim;
end
Error: Undefined function 'limit' for input arguments of type 'char'.
Derivative:
function divCalcButtonPushed(app, event)
syms x
f = 3*x^2 + 2*x^(-2);
f = diff(f);
app.divansEditField.Value=f;
end
Error:
Error using matlab.ui.control.EditField/set.Value (line 98)
'Value' must be a character vector or a string scalar.
Thank you.
回答(1 个)
Reshma Nerella
2021-1-31
Hi
There are two types of Edit Fields, one for Numeric values and the other one is for text.
If you try to store or retreive values from a from Edit Field(text), it will of type 'char'.
I think you are using Edit Feild(text) for downEditField, upEditField.
Convert the data type to the ones the functions(like int) support and then pass them as arguments
Since 'int' function doesn't take 'char' as input, it is showing you the error
Undefined function 'int' for input arguments of type 'char'.
Hope this helps!!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Install Products 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!