Function giving incorrect answer
Mostra commenti meno recenti
Hi, new to matlab and I was following through a guide and got to the functions section but I have a problem. Its a very basic function to add two numbers together:
function add (x,y)
x+y
end
In the command window I enter "add 5 3" to which it gives
>> add 5 3
ans =
104
Are there any settings I need to change or something??
I think it is something to do with the variables since addition without the function works perfectly
>> 3+5
ans =
8
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!