title: Mldivide in Parallel package
body: <p>When the following line executes as part of parfor loop, its executes even if the G matrix is ill-conditioned.</p>
  
  <pre><code>betas = G\data.y2.';
  </code></pre>
  
  <p>However when I try to run it as part of a regular for loop the code stops executing and it reports that the Matrix is singular.</p>
  
  <p>Why do the for and parfor loops handle it differently?</p>
  
  <p>The reason I ask is that I am debugging some code that someone else wrote. I can't debug a parfor so I was hoping to find out what was happening by looking at the for equivalent.</p>
  
  <p>Is there a way that I can debug parallel code where I can expect the code to behave the same way it would in the parallel environment?</p>
  
  <p>Also what does <code>data.y2.</code>; mean as opposed to <code>data.y2'</code>;</p>
  
  <p>Further I have an older version of the code that is designed to run purely in a regular for loop.</p>
  
  <p>When I went back to run that I got the same error that stopped the code running.</p>
  
  <p>However when I restarted MATLAB and ran it again it ran no problem. It simply takes the result of inverting the singular matrix to be <code>NaN</code> and continues (which is what I want).</p>
  
  <p>In the parallel version the following declarations are made:</p>
  
  <pre><code>warnState(1) = warning('error', 'MATLAB:singularMatrix'); 
  warnState(2) = warning('error', 'MATLAB:illConditionedMatrix'); 
  </code></pre>
  
  <p>Are these what are causing the code to stop?
  If so why are they not affecting the parallel version?</p>