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.
Type: integer
Dimension: scalar

Outputs

s
A string containing the variable name passed into the function.
Type: char
Dimension: string

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).