top of page
  • Writer's pictureAdisorn O.

Passing functions as arguments in MATLAB

MATLAB allows us to pass functions as arguments of another function. This is very useful when we call other functions (for example, library functions) inside our new function.

Studying the following four cases of how to transfer function as an argument:

In the last case, we use f3 = @Userfun1 and then pass f3 as an argument. Alternatively, we can pass @Userfun1 directly. The sign @ tells the program that we are passing a function, not a variable.



bottom of page