inputname
Indicate the variable name of the n-th argument passed into a function.
Syntax
R = inputname(x, ...)
R = x'
Inputs
- x
- The index of the n-th variable passed into a function.
Outputs
- s
- A string containing the variable name passed into the function.
Example
function z=foo(x)
z=inputname(1);
end
varname = 7;
s = foo(varname)
s = varname
Comments
inputname will return an empty string if the input is not a variable (e.g. an expression).