title: Matlab Parallelism toolbox : stacking loops in parfor
body: <p>I'm trying to use the parfor loop in the matlab parallelism package.
  I'm having a similar problem to this guy : <a href="https://stackoverflow.com/questions/5207667/matlab-parfor-slicing-issue">MATLAB parfor slicing issue?</a> . The output matrix doesn't seem to be recognized as a sliced variable. In my specific case, I'm trying to stack use other for loops inside the parfor, and I have trouble applying the solution proposed in the other thread to my problem. Here is a dummy example of what I'm trying to do :</p>
  
  <pre><code>n=175;
  matlabpool;
  
  Matred=zeros(n,n);
  
  Matx2Cell = cell(n);
  
  parfor i=1:n
      for j=1:n
          for k=1:n
  
              Matred(j,k)=exp((j+i+k)/500)
          end;
      end;
      Matx2Cell{i}=Matred;
  
  end;
  matlabpool close;
  </code></pre>
  
  <p>P.S. I know it would work to put the parfor on the k-loop instead of the i-loop... But I'd still like to put it on the i-loop (I believe it would be more time-efficient in my real program).</p>
  
  <p>Thanks a lot
  Frédéric Godin</p>