How do i use handles with my local function?

3 vues (au cours des 30 derniers jours)
JoaWei
JoaWei le 10 Sep 2020
Commenté : madhan ravi le 10 Sep 2020
So if i,m using a anonymous function with a ordinary equation i can write it like this.
f = @(x) x^2
and pass f(1) = 1, f(2) = 2 and so on.
But if i define a function
function return = test(x,y,z)
and want to use this function in the anonymous function, how do i write this?
f = @(x,y,z,) test ??

Réponses (1)

madhan ravi
madhan ravi le 10 Sep 2020
f = @test
f(1,2,3)
Note: Never assign a variable named as return shadows inbuilt function

Catégories

En savoir plus sur Function Handles dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by