title: How to get inputname of variable passed into function through cellfun?
body: <p>I know that the custom function <code>myfun</code> outputs the variable names that are passed to it using the <a href="http://www.mathworks.com/help/matlab/ref/inputname.html" rel="nofollow"><code>inputname</code></a> command.</p>
  
  <p>However, when I pass variables through a <code>cellfun</code> the <code>inputname</code> command ceases to work, as shown below (where I am passing in the variable names <code>j</code>, <code>lat</code>, and <code>lon</code>. Here, it just somehow outputs all the variables as 'x'.</p>
  
  <pre><code>&gt;&gt; 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'
  </code></pre>
  
  <p>And if I try:</p>
  
  <pre><code>cellfun(@myfun, {j}, 'UniformOutput', false)
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>First calling variable is "".
  
  ans = 
      {''}
  </code></pre>
  
  <p>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.</p>