Calculating limits, derivatives, and integrals in AppDesigner
1 回表示 (過去 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 件のコメント
回答 (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!