How to dynamically check number of arguments of an anonymous function?

Viewed 41

Part of my octave program takes an anonymous function from the user and evaluates it with random inputs. I want to make it as generalizable as possible so an arbitrary N dimensional function can be input, but I don't know how to dynamically determine the dimensionality of the input function.

1 Answers

Given a function name or handle fcn, nargin(fcn) returns the declared number of input arguments.

Reference.

Related