Skip to content

inputname

Variable name of a function argument from the caller’s perspective.

sname = inputname(argindex)

Inside a function body, returns the name of the variable that was passed as argument argindex. Returns an empty string if the argument was a literal expression rather than a named variable.

function showname(x); fprintf('arg name: %s\n', inputname(1)); end
  • nargin — Number of input arguments passed to the current function.
  • nargchk — Validate the number of input arguments.