I know that the custom function myfun
outputs the variable names that are passed to it using the inputname
command.
However, when I pass variables through a cellfun
the inputname
command ceases to work, as shown below (where I am passing in the variable names j
, lat
, and lon
. Here, it just somehow outputs all the variables as 'x'.
>> cellfun(@(x)myfun(x, y), {j, lat, lon}, 'UniformOutput', false)
First calling variable is "x".
First calling variable is "x".
First calling variable is "x".
ans =
'x' 'x' 'x'
And if I try:
cellfun(@myfun, {j}, 'UniformOutput', false)
I get:
First calling variable is "".
ans =
{''}
I'm doing this because I'm creating a bunch of plots with a function, and would like all the plots auto-labeled with the variable name of the variable I'm passing into the plots.