Calculating limits, derivatives, and integrals in AppDesigner

7 vues (au cours des 30 derniers jours)
BackBackDo
BackBackDo le 22 Jan 2021
Commenté : rony guzman le 12 Sep 2022
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 commentaire
rony guzman
rony guzman le 12 Sep 2022
envia el archivo del codigo que utilizaste, me serviria.

Connectez-vous pour commenter.

Réponses (1)

Reshma Nerella
Reshma Nerella le 31 Jan 2021
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'.
For more information on Edit Field refer to the documentation page: uieditfield
Hope this helps!!

Community Treasure Hunt

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

Start Hunting!

Translated by