Number of input parameters of a function.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Milad Omidi
le 5 Avr 2019
Commenté : John D'Errico
le 5 Avr 2019
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
0 commentaires
Réponse acceptée
Walter Roberson
le 5 Avr 2019
nargin(FunctionHandle)
1 commentaire
John D'Errico
le 5 Avr 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:
@(x,y)x+y
>> methods(H)
Methods for class function_handle:
display func2str functions nargin nargout
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!