title: Why I got this Error The variable in a parfor cannot be classified
body: <p>I'm trying to use parfor to estimate the time it takes over 96 sec and I've more than one image to treat but I got this error:</p>
  
  <blockquote>
    <p>The variable B in a parfor cannot be classified</p>
  </blockquote>
  
  <p>this the code I've written:</p>
  
  <pre><code>Io=im2double(imread('C:My path\0.1s.tif')); 
  Io=double(Io);
  In=Io;
  sigma=[1.8 20];
  [X,Y] = meshgrid(-3:3,-3:3);
  G = exp(-(X.^2+Y.^2)/(2*1.8^2));
  dim = size(In);
  B = zeros(dim);
  c = parcluster
    matlabpool(c)
  parfor i = 1:dim(1)
      for  j = 1:dim(2)
           % Extract local region.
           iMin = max(i-3,1);
           iMax = min(i+3,dim(1));
           jMin = max(j-3,1);
           jMax = min(j+3,dim(2));
           I = In(iMin:iMax,jMin:jMax);
           % Compute Gaussian intensity weights.
           H = exp(-(I-In(i,j)).^2/(2*20^2));
           % Calculate bilateral filter response.
           F = H.*G((iMin:iMax)-i+3+1,(jMin:jMax)-j+3+1);
           B(i,j) = sum(F(:).*I(:))/sum(F(:));   
    end
     end
   matlabpool close
  </code></pre>
  
  <p>any Idea?</p>