Number of input parameters of a function.

1 次查看(过去 30 天)
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.
-Milad

采纳的回答

Walter Roberson
Walter Roberson 2019-4-5
nargin(FunctionHandle)
  1 个评论
John D'Errico
John D'Errico 2019-4-5
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:
@(x,y)x+y
>> methods(H)
Methods for class function_handle:
display func2str functions nargin nargout

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by