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

1 visualización (últimos 30 días)
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.

Respuestas (1)

Kevin Holly
Kevin Holly el 13 de Oct. de 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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by