title: "Variable in a parfor cannot be classified" MATLAB
body: <p>I am trying to convert my code over to run with parfor, since as it is it takes a long time to run on its own. However I keep getting this error. I have search around on the website and have read people with similar problems, but none of those answers seem to fix my problem. This is my code:</p>
  
  <pre><code>r = 5;
  
  Mu = 12.57e-9;
  
  Nu = 12e6;
  
  I = 1.8;
  
  const = pi*Nu*Mu*r*I;
  
  a = 55;
  
  b = 69;
  
  c = 206;
  
  [m,n,p] = size(Lesion_Visible);
  
  A = zeros(m,n,p);
  
  parpool(2)
  
  syms k
  
  parfor J = 1:m
       for  I = 1:n
           for K = 1:p
               if Lesion_Visible(J,I,K) ~= 0
                    Theta = atand((J-b)/(I-a));
                    Rho = abs((I-a)/cosd(Theta))*0.05;
                    Z = abs(c-K)*0.05;
                    E = vpa(const*int(abs(besselj(0,Rho*k)*exp(-Z*k)*besselj(0,r*k)),0,20),5);
                    A (J,I,K) = E;
               end
           end
      end
  end
  </code></pre>
  
  <p>I'm trying to calculate the electric field in specific position on an array and matlab give me the error "The variable A in a parfor cannot be classified". I need help. Thanks.</p>