MATLAB Function Reference | ![]() ![]() |
Syntax
inputname(argnum
)
Description
This command can be used only inside the body of a function.
inputname(
returns the workspace variable name corresponding to the argument number argnum
)
argnum
. If the input argument has no name (for example, if it is an expression instead of a variable), the inputname
command returns the empty string (''
).
Examples
Suppose the function myfun.m
is defined as:
function c = myfun(a,b) disp(sprintf('First calling variable is "%s".',inputname(1))
x = 5; y = 3; myfun(x,y)
First calling variable is "x".
myfun(pi+1,pi-1)
First calling variable is "".
See Also
![]() | inputdlg | inspect | ![]() |