title: How to get the number of arguments of the caller function in Matlab2015b?
body: <p>The below code should run successfully. The assert statement passes in <strong>Matlab2014b</strong>, but fails in <strong>Matlab2015b</strong>.</p>
  
  <p>How would you get the number of arguments for the caller function in Matlab2015b?</p>
  
  <pre><code>function test()
      fnA(1);
  end
  
  function fnA(A1, A2)
      n = nargin;
      fnB(1, 2);
      assert(n==A2, '%d does not equal %d', n, A2);
  end
  
  function fnB(B1, B2)
      n = evalin('caller', 'nargin');
      assignin('caller', 'A2', n);
  end
  </code></pre>