inputname
- :
namestr =inputname(n)¶ - :
namestr =inputname(n, ids_only)¶ Return, as a string, the name of the n-th argument passed to the function from which
inputnameis called.n must be a positive integer scalar that indexes the argument list of the calling function.
By default (ids_only true) a name is produced only when the matching argument was supplied as a plain variable; if it was anything else – a literal such as
5.1, an expression such asy/2, or an indexing result such asc{1}ors.field– the empty string is returned instead.Passing ids_only as false lifts that restriction and returns the source text of the argument even when it is not a simple variable name, letting a function observe exactly how it was invoked. This second argument is a Nexus extension beyond MATLAB.
inputnameis meaningful only inside a function. At the command line or within a script it always returns the empty string.