Whenever I try to use my function f(x,y) I get an error message that says that I need to define f.

1 view (last 30 days)
f = @(x,y) x+y;
and the error message i get says
"The value assigned to the variable 'f' might be unused."
I do not know what to do or what is happening, I am working on a Eulers project and I need the function to run correctly.

Answers (1)

Kevin Holly
Kevin Holly on 13 Oct 2021
I do not have the error when I run it.
f = @(x,y) x+y;
f(6,7)
ans = 13
Are you defining f as a variable afterwards as such?
f = @(x,y) x+y;
f = 6
f = 6

Community Treasure Hunt

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

Start Hunting!