title: globals and parfor
body: <p>Inside a <code>parfor</code> loop, I am trying to call a function that accesses a <code>global</code> to no avail.</p>
  
  <p>The function </p>
  
  <pre><code>function a = getA()
     global OPTIONS;
     a=OPTIONS.PROBLEM.A;
  end
  </code></pre>
  
  <p>The loop:</p>
  
  <pre><code>parfor i=1:3
      b=getA();
  end
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>Error using parallel_function (line 589)
  
  Attempt to reference field of non-structure array.
  </code></pre>
  
  <p>What am I doing wrong?</p>