title: mexGetArrayPtr not working as expected
body: <p>I have the following test_mex mex function:</p>
  
  <pre><code>void mexFunction(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
  {
    const mxArray* m_var = NULL;
    if ((m_var = mexGetArrayPtr("a", "caller")) == NULL)
    {
      mexErrMsgTxt("oopsie");
    }
  }
  </code></pre>
  
  <p>And the following test.m file:</p>
  
  <pre><code>function test()
    a = 12345;
    test_mex();
  </code></pre>
  
  <ul>
  <li>When I run it it always fails and prints "oopsie".</li>
  <li>When I make <code>a</code> a global and change the "caller" string in the mex function to "global" it works fine.</li>
  </ul>
  
  <p>What am I doing wrong?</p>
  
  <p>Notes:</p>
  
  <ul>
  <li>this is a positively ancient version of matlab: Version 6.1.0.450 Release 12.1</li>
  <li>mexGetArrayPtr is the old version of mexGetVariablePtr and yes its argument order is different</li>
  </ul>