Number of input parameters of a function.

2 views (last 30 days)
If you have a function's handle,
Is there any way to figure out how many input parameters it expects in the function's signature?
Even ugly hacky ways are fine.

Accepted Answer

Walter Roberson
Walter Roberson on 5 Apr 2019
  1 Comment
John D'Errico
John D'Errico on 5 Apr 2019
A good way to learn this would have worked is to use methods. For example:
H = @(x,y) x+y
H =
function_handle with value:
>> methods(H)
Methods for class function_handle:
display func2str functions nargin nargout

Sign in to comment.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!